/*
 * GoJS v2.2.7 JavaScript Library for HTML Diagrams, https://gojs.net
 * GoJS and Northwoods Software are registered trademarks of Northwoods Software Corporation, https://www.nwoods.com.
 * Copyright (C) 1998-2022 by Northwoods Software Corporation.  All Rights Reserved.
 * THIS SOFTWARE IS LICENSED.  THE LICENSE AGREEMENT IS AT: https://gojs.net/2.2.7/license.html.
 * DO NOT MODIFY THIS FILE.  DO NOT DISTRIBUTE A MODIFIED COPY OF THE CONTENTS OF THIS FILE.
 */
(function() { var t;function ba(a){var b=0;return function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}}}function ca(a){var b="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];return b?b.call(a):{next:ba(a)}}function da(a){for(var b,c=[];!(b=a.next()).done;)c.push(b.value);return c}var ea="function"==typeof Object.create?Object.create:function(a){function b(){}b.prototype=a;return new b},fa;
if("function"==typeof Object.setPrototypeOf)fa=Object.setPrototypeOf;else{var ha;a:{var ja={a:!0},ka={};try{ka.__proto__=ja;ha=ka.a;break a}catch(a){}ha=!1}fa=ha?function(a,b){a.__proto__=b;if(a.__proto__!==b)throw new TypeError(a+" is not extensible");return a}:null}var la=fa;
function ma(a,b){a.prototype=ea(b.prototype);a.prototype.constructor=a;if(la)la(a,b);else for(var c in b)if("prototype"!=c)if(Object.defineProperties){var d=Object.getOwnPropertyDescriptor(b,c);d&&Object.defineProperty(a,c,d)}else a[c]=b[c];a.DB=b.prototype}
var na="undefined"!=typeof global&&null!=global?global:self,oa="function"==typeof Object.assign?Object.assign:function(a,b){for(var c=1;c<arguments.length;c++){var d=arguments[c];if(d)for(var e in d)Object.prototype.hasOwnProperty.call(d,e)&&(a[e]=d[e])}return a},pa="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)};
function ra(a,b){if(b){var c=na;a=a.split(".");for(var d=0;d<a.length-1;d++){var e=a[d];e in c||(c[e]={});c=c[e]}a=a[a.length-1];d=c[a];b=b(d);b!=d&&null!=b&&pa(c,a,{configurable:!0,writable:!0,value:b})}}ra("Object.assign",function(a){return a||oa});
ra("String.prototype.startsWith",function(a){return a?a:function(a,c){if(null==this)throw new TypeError("The 'this' value for String.prototype.startsWith must not be null or undefined");if(a instanceof RegExp)throw new TypeError("First argument to String.prototype.startsWith must not be a regular expression");var b=this.length,e=a.length;c=Math.max(0,Math.min(c|0,this.length));for(var f=0;f<e&&c<b;)if(this[c++]!=a[f++])return!1;return f>=e}});
ra("Array.prototype.fill",function(a){return a?a:function(a,c,d){var b=this.length||0;0>c&&(c=Math.max(0,b+c));if(null==d||d>b)d=b;d=Number(d);0>d&&(d=Math.max(0,b+d));for(c=Number(c||0);c<d;c++)this[c]=a;return this}});var sa="object"===typeof globalThis&&globalThis||"object"===typeof global&&global.global===global&&global||"object"===typeof self&&self.self===self&&self||{};void 0===sa.requestAnimationFrame&&(void 0===sa.setImmediate?sa.requestAnimationFrame=function(a){sa.setTimeout(a,0)}:sa.requestAnimationFrame=sa.setImmediate);function ta(){}function ua(a,b){var c=-1;return function(){var d=this,e=arguments;-1!==c&&sa.clearTimeout(c);c=va(function(){c=-1;a.apply(d,e)},b)}}
function va(a,b){return sa.setTimeout(a,b)}function wa(a){return sa.document.createElement(a)}function v(a){throw Error(a);}function xa(a,b){a="The object is frozen, so its properties cannot be set: "+a.toString();void 0!==b&&(a+="  to value: "+b);v(a)}function w(a,b,c,d){a instanceof b||(c=ya(c),void 0!==d&&(c+="."+d),za(a,b,c))}function A(a,b,c,d){typeof a!==b&&(c=ya(c),void 0!==d&&(c+="."+d),za(a,b,c))}
function E(a,b,c){"number"===typeof a&&isFinite(a)||(b=ya(b),void 0!==c&&(b+="."+c),v(b+" must be a real number type, and not NaN or Infinity: "+a))}function za(a,b,c,d){b=" value is not an instance of "+ya(b)+": ";c=ya(c);void 0!==d&&(c+="."+d);"string"===typeof a&&(a='"'+a+'"');v(c+b+a)}function Ba(a,b,c,d){c=ya(c);void 0!==d&&(c+="."+d);v(c+" is not in the range "+b+": "+a)}function Ca(a){v(("string"===typeof a.className?a.className:"")+" constructor cannot take any arguments.")}
function Da(a){v("Collection was modified during iteration: "+a.toString()+"\n  Perhaps you should iterate over a copy of the collection,\n  or you could collect items to be removed from the collection after the iteration.")}function Ea(a,b){v("No property to set for this enum value: "+b+" on "+a.toString())}function Fa(a){sa.console&&sa.console.log(a)}function Ga(a){return"object"===typeof a&&null!==a}
function Ha(a){return Array.isArray(a)||sa.NodeList&&a instanceof sa.NodeList||sa.HTMLCollection&&a instanceof sa.HTMLCollection}function Ia(a,b,c){Ha(a)||za(a,"Array or NodeList or HTMLCollection",b,c)}function Ja(a){return Array.prototype.slice.call(a)}function Ka(a,b,c){Array.isArray(a)?b>=a.length?a.push(c):a.splice(b,0,c):v("Cannot insert an object into an HTMLCollection or NodeList: "+c+" at "+b)}
function La(a,b){Array.isArray(a)?b>=a.length?a.pop():a.splice(b,1):v("Cannot remove an object from an HTMLCollection or NodeList at "+b)}function Na(){var a=Oa.pop();return void 0===a?[]:a}function Pa(a){a.length=0;Oa.push(a)}function ya(a){return null===a?"*":"string"===typeof a?a:"function"===typeof a&&"string"===typeof a.className?a.className:""}
function Qa(a){if("function"===typeof a){if(a.className)return a.className;if(a.name)return a.name;var b=a.toString();b=b.substring(9,b.indexOf("(")).trim();if(""!==b)return a._className=b}else if(Ga(a)&&a.constructor)return Qa(a.constructor);return typeof a}
function Ra(a){var b=a;Ga(a)&&(a.text?b=a.text:a.name?b=a.name:void 0!==a.key?b=a.key:void 0!==a.id?b=a.id:a.constructor===Object&&(a.Text?b=a.Text:a.Name?b=a.Name:void 0!==a.Key?b=a.Key:void 0!==a.Id?b=a.Id:void 0!==a.ID&&(b=a.ID)));return void 0===b?"undefined":null===b?"null":b.toString()}function Sa(a,b){if(a.hasOwnProperty(b))return!0;for(a=Object.getPrototypeOf(a);a&&a!==Function;){if(a.hasOwnProperty(b))return!0;var c=a.tB;if(c&&c[b])return!0;a=Object.getPrototypeOf(a)}return!1}
function Ua(a,b,c){Object.defineProperty(Va.prototype,a,{get:b,set:c})}
function Wa(a){for(var b=[],c=0;256>c;c++)b["0123456789abcdef".charAt(c>>4)+"0123456789abcdef".charAt(c&15)]=String.fromCharCode(c);a.length%2&&(a="0"+a);c=[];for(var d=0,e=0;e<a.length;e+=2)c[d++]=b[a.substr(e,2)];a=c.join("");a=""===a?"0":a;b=[];for(c=0;256>c;c++)b[c]=c;for(c=d=0;256>c;c++)d=(d+b[c]+119)%256,e=b[c],b[c]=b[d],b[d]=e;d=c=0;for(var f="",g=0;g<a.length;g++)c=(c+1)%256,d=(d+b[c])%256,e=b[c],b[c]=b[d],b[d]=e,f+=String.fromCharCode(a.charCodeAt(g)^b[(b[c]+b[d])%256]);return f}
var Xa=void 0!==sa.navigator&&0<sa.navigator.userAgent.indexOf("Trident/7"),Za=void 0!==sa.navigator&&0<sa.navigator.userAgent.indexOf("Edge/"),$a=void 0!==sa.navigator&&void 0!==sa.navigator.platform&&null!==sa.navigator.platform.match(/(iPhone|iPod|iPad|Mac)/i),Oa=[];Object.freeze([]);ta.className="Util";ta.Dx="32ab5ff3b26f42dc0ed90f21462913b5";ta.adym="gojs.net";ta.vfo="28e644fdb4";ta.className="Util";function F(a,b,c){ab(this);this.j=a;this.ta=b;this.o=c}
F.prototype.toString=function(){return"EnumValue."+this.ta};function cb(a,b){return void 0===b||null===b||""===b?null:a[b]}function db(a,b,c,d){a.classType!==b&&(c=ya(c),void 0!==d&&(c+="."+d),za(a,"function"==="a constant of class "+typeof b.className?b.className:"",c))}na.Object.defineProperties(F.prototype,{classType:{configurable:!0,get:function(){return this.j}},name:{configurable:!0,get:function(){return this.ta}},value:{configurable:!0,get:function(){return this.o}}});
F.className="EnumValue";function eb(){this.Rw=[]}eb.prototype.toString=function(){return this.Rw.join("")};eb.prototype.add=function(a){""!==a&&this.Rw.push(a)};eb.className="StringBuilder";function fb(){}fb.className="PropertyCollection";
var G={gm:!1,Zx:!1,vB:!1,xB:!1,BB:!1,qy:!1,Yx:!1,uB:null,trace:function(a){sa.console&&sa.console.log(a)},wB:function(a,b,c,d){a.strokeStyle="red";a.fillStyle="red";a.font="8px sans-serif";a.beginPath();a.moveTo(-10,0);a.lineTo(10,0);a.moveTo(0,-10);a.lineTo(0,10);a.stroke();a.setTransform(1,0,0,1,0,0);a.scale(c,c);a.transform(b.m11,b.m12,b.m21,b.m22,b.dx,b.dy);a.lineWidth=2;a.beginPath();a.moveTo(d.left,d.top+20);a.lineTo(d.left,d.top);a.lineTo(d.left+20,d.top);a.moveTo(d.right,d.bottom-20);a.lineTo(d.right,
d.bottom);a.lineTo(d.right-20,d.bottom);a.stroke();a.fillText("DB: "+Math.round(d.x)+", "+Math.round(d.y)+", "+Math.round(d.width)+", "+Math.round(d.height),d.left,d.top-5)},yz:function(a){var b={},c;for(c in a){b.x=c;if("licenseKey"!==b.x){var d=a[b.x];if(void 0!==d.prototype){b.wm=Object.getOwnPropertyNames(d.prototype);for(var e={lk:0};e.lk<b.wm.length;e={lk:e.lk},e.lk++){var f=Object.getOwnPropertyDescriptor(d.prototype,b.wm[e.lk]);void 0!==f.get&&void 0===f.set&&Object.defineProperty(d.prototype,
b.wm[e.lk],{set:function(a,b){return function(){throw Error("Property "+a.wm[b.lk]+" of "+a.x+" is read-only.");}}(b,e)})}}}b={wm:b.wm,x:b.x}}}};function gb(){}gb.prototype.reset=function(){};gb.prototype.next=function(){return!1};gb.prototype.xd=function(){return!1};gb.prototype.first=function(){return null};gb.prototype.any=function(){return!1};gb.prototype.all=function(){return!0};gb.prototype.each=function(){return this};gb.prototype.map=function(){return this};gb.prototype.filter=function(){return this};
gb.prototype.Zd=function(){};gb.prototype.toString=function(){return"EmptyIterator"};na.Object.defineProperties(gb.prototype,{iterator:{configurable:!0,get:function(){return this}},count:{configurable:!0,get:function(){return 0}}});gb.prototype.first=gb.prototype.first;gb.prototype.hasNext=gb.prototype.xd;gb.prototype.next=gb.prototype.next;gb.prototype.reset=gb.prototype.reset;var hb=null;gb.className="EmptyIterator";hb=new gb;function ib(a){this.key=-1;this.value=a}
ib.prototype.reset=function(){this.key=-1};ib.prototype.next=function(){return-1===this.key?(this.key=0,!0):!1};ib.prototype.xd=function(){return this.next()};ib.prototype.first=function(){this.key=0;return this.value};ib.prototype.any=function(a){this.key=-1;return a(this.value)};ib.prototype.all=function(a){this.key=-1;return a(this.value)};ib.prototype.each=function(a){this.key=-1;a(this.value);return this};ib.prototype.map=function(a){return new ib(a(this.value))};
ib.prototype.filter=function(a){return a(this.value)?new ib(this.value):hb};ib.prototype.Zd=function(){this.value=null};ib.prototype.toString=function(){return"SingletonIterator("+this.value+")"};na.Object.defineProperties(ib.prototype,{iterator:{configurable:!0,get:function(){return this}},count:{configurable:!0,get:function(){return 1}}});ib.prototype.first=ib.prototype.first;ib.prototype.hasNext=ib.prototype.xd;ib.prototype.next=ib.prototype.next;
ib.prototype.reset=ib.prototype.reset;ib.className="SingletonIterator";function jb(a){this.wb=a;this.sf=null;a.Oa=null;this.oa=a.w;this.Xa=-1}jb.prototype.reset=function(){var a=this.wb;a.Oa=null;this.oa=a.w;this.Xa=-1};jb.prototype.next=function(){var a=this.wb;if(a.w!==this.oa){if(0>this.key)return!1;Da(a)}a=a.m;var b=a.length,c=++this.Xa,d=this.sf;if(null!==d)for(;c<b;){var e=a[c];if(d(e))return this.key=this.Xa=c,this.value=e,!0;c++}else{if(c<b)return this.key=c,this.value=a[c],!0;this.Zd()}return!1};
jb.prototype.xd=function(){return this.next()};jb.prototype.first=function(){var a=this.wb;this.oa=a.w;this.Xa=0;a=a.m;var b=a.length,c=this.sf;if(null!==c){for(var d=0;d<b;){var e=a[d];if(c(e))return this.key=this.Xa=d,this.value=e;d++}return null}return 0<b?(a=a[0],this.key=0,this.value=a):null};jb.prototype.any=function(a){var b=this.wb;b.Oa=null;var c=b.w;this.Xa=-1;for(var d=b.m,e=d.length,f=this.sf,g=0;g<e;g++){var h=d[g];if(null===f||f(h)){if(a(h))return!0;b.w!==c&&Da(b)}}return!1};
jb.prototype.all=function(a){var b=this.wb;b.Oa=null;var c=b.w;this.Xa=-1;for(var d=b.m,e=d.length,f=this.sf,g=0;g<e;g++){var h=d[g];if(null===f||f(h)){if(!a(h))return!1;b.w!==c&&Da(b)}}return!0};jb.prototype.each=function(a){var b=this.wb;b.Oa=null;var c=b.w;this.Xa=-1;for(var d=b.m,e=d.length,f=this.sf,g=0;g<e;g++){var h=d[g];if(null===f||f(h))a(h),b.w!==c&&Da(b)}return this};
jb.prototype.map=function(a){var b=this.wb;b.Oa=null;var c=b.w;this.Xa=-1;for(var d=[],e=b.m,f=e.length,g=this.sf,h=0;h<f;h++){var k=e[h];if(null===g||g(k))d.push(a(k)),b.w!==c&&Da(b)}a=new H;a.m=d;a.qb();return a.iterator};jb.prototype.filter=function(a){var b=this.wb;b.Oa=null;var c=b.w;this.Xa=-1;for(var d=[],e=b.m,f=e.length,g=this.sf,h=0;h<f;h++){var k=e[h];if(null===g||g(k))a(k)&&d.push(k),b.w!==c&&Da(b)}a=new H;a.m=d;a.qb();return a.iterator};
jb.prototype.Zd=function(){this.key=-1;this.value=null;this.oa=-1;this.sf=null;this.wb.Oa=this};jb.prototype.toString=function(){return"ListIterator@"+this.Xa+"/"+this.wb.count};
na.Object.defineProperties(jb.prototype,{iterator:{configurable:!0,get:function(){return this}},predicate:{configurable:!0,get:function(){return this.sf},set:function(a){this.sf=a}},count:{configurable:!0,get:function(){var a=this.sf;if(null!==a){for(var b=0,c=this.wb.m,d=c.length,e=0;e<d;e++)a(c[e])&&b++;return b}return this.wb.m.length}}});jb.prototype.first=jb.prototype.first;jb.prototype.hasNext=jb.prototype.xd;jb.prototype.next=jb.prototype.next;
jb.prototype.reset=jb.prototype.reset;jb.className="ListIterator";function kb(a){this.wb=a;a.eh=null;this.oa=a.w;this.Xa=a.m.length}kb.prototype.reset=function(){var a=this.wb;a.eh=null;this.oa=a.w;this.Xa=a.m.length};kb.prototype.next=function(){var a=this.wb;if(a.w!==this.oa){if(0>this.key)return!1;Da(a)}var b=--this.Xa;if(0<=b)return this.key=b,this.value=a.m[b],!0;this.Zd();return!1};kb.prototype.xd=function(){return this.next()};
kb.prototype.first=function(){var a=this.wb;this.oa=a.w;var b=a.m;this.Xa=a=b.length-1;return 0<=a?(b=b[a],this.key=a,this.value=b):null};kb.prototype.any=function(a){var b=this.wb;b.eh=null;var c=b.w,d=b.m,e=d.length;this.Xa=e;for(--e;0<=e;e--){if(a(d[e]))return!0;b.w!==c&&Da(b)}return!1};kb.prototype.all=function(a){var b=this.wb;b.eh=null;var c=b.w,d=b.m,e=d.length;this.Xa=e;for(--e;0<=e;e--){if(!a(d[e]))return!1;b.w!==c&&Da(b)}return!0};
kb.prototype.each=function(a){var b=this.wb;b.eh=null;var c=b.w,d=b.m,e=d.length;this.Xa=e;for(--e;0<=e;e--)a(d[e]),b.w!==c&&Da(b);return this};kb.prototype.map=function(a){var b=this.wb;b.eh=null;var c=b.w,d=[],e=b.m,f=e.length;this.Xa=f;for(--f;0<=f;f--)d.push(a(e[f])),b.w!==c&&Da(b);a=new H;a.m=d;a.qb();return a.iterator};
kb.prototype.filter=function(a){var b=this.wb;b.eh=null;var c=b.w,d=[],e=b.m,f=e.length;this.Xa=f;for(--f;0<=f;f--){var g=e[f];a(g)&&d.push(g);b.w!==c&&Da(b)}a=new H;a.m=d;a.qb();return a.iterator};kb.prototype.Zd=function(){this.key=-1;this.value=null;this.oa=-1;this.wb.eh=this};kb.prototype.toString=function(){return"ListIteratorBackwards("+this.Xa+"/"+this.wb.count+")"};
na.Object.defineProperties(kb.prototype,{iterator:{configurable:!0,get:function(){return this}},count:{configurable:!0,get:function(){return this.wb.m.length}}});kb.prototype.first=kb.prototype.first;kb.prototype.hasNext=kb.prototype.xd;kb.prototype.next=kb.prototype.next;kb.prototype.reset=kb.prototype.reset;kb.className="ListIteratorBackwards";
function H(a){ab(this);this.u=!1;this.m=[];this.w=0;this.eh=this.Oa=null;(G&&"function"===typeof a||"string"===typeof a)&&v("Error: Since 2.0 List/Map/Set constructors no longer take an argument that enforces type.");void 0!==a&&this.addAll(a)}t=H.prototype;t.qb=function(){var a=this.w;a++;999999999<a&&(a=0);this.w=a};t.freeze=function(){this.u=!0;return this};t.ka=function(){this.u=!1;return this};t.toString=function(){return"List()#"+lb(this)};
t.add=function(a){if(null===a)return this;this.u&&xa(this,a);this.m.push(a);this.qb();return this};t.push=function(a){this.add(a)};t.addAll=function(a){if(null===a)return this;this.u&&xa(this);var b=this.m;if(Ha(a))for(var c=a.length,d=0;d<c;d++)b.push(a[d]);else for(a=a.iterator;a.next();)b.push(a.value);this.qb();return this};t.clear=function(){this.u&&xa(this);this.m.length=0;this.qb()};t.contains=function(a){return null===a?!1:-1!==this.m.indexOf(a)};t.has=function(a){return this.contains(a)};
t.indexOf=function(a){return null===a?-1:this.m.indexOf(a)};t.M=function(a){G&&E(a,H,"elt:i");var b=this.m;(0>a||a>=b.length)&&Ba(a,"0 <= i < length",H,"elt:i");return b[a]};t.get=function(a){return this.M(a)};t.Vc=function(a,b){G&&E(a,H,"setElt:i");var c=this.m;(0>a||a>=c.length)&&Ba(a,"0 <= i < length",H,"setElt:i");this.u&&xa(this,a);c[a]=b};t.set=function(a,b){this.Vc(a,b)};t.first=function(){var a=this.m;return 0===a.length?null:a[0]};
t.fc=function(){var a=this.m,b=a.length;return 0<b?a[b-1]:null};t.pop=function(){this.u&&xa(this);var a=this.m;return 0<a.length?a.pop():null};H.prototype.any=function(a){for(var b=this.m,c=this.w,d=b.length,e=0;e<d;e++){if(a(b[e]))return!0;this.w!==c&&Da(this)}return!1};H.prototype.all=function(a){for(var b=this.m,c=this.w,d=b.length,e=0;e<d;e++){if(!a(b[e]))return!1;this.w!==c&&Da(this)}return!0};
H.prototype.each=function(a){for(var b=this.m,c=this.w,d=b.length,e=0;e<d;e++)a(b[e]),this.w!==c&&Da(this);return this};H.prototype.map=function(a){for(var b=new H,c=[],d=this.m,e=this.w,f=d.length,g=0;g<f;g++)c.push(a(d[g])),this.w!==e&&Da(this);b.m=c;b.qb();return b};H.prototype.filter=function(a){for(var b=new H,c=[],d=this.m,e=this.w,f=d.length,g=0;g<f;g++){var h=d[g];a(h)&&c.push(h);this.w!==e&&Da(this)}b.m=c;b.qb();return b};t=H.prototype;
t.Bb=function(a,b){G&&E(a,H,"insertAt:i");0>a&&Ba(a,">= 0",H,"insertAt:i");this.u&&xa(this,a);var c=this.m;a>=c.length?c.push(b):c.splice(a,0,b);this.qb()};t.remove=function(a){if(null===a)return!1;this.u&&xa(this,a);var b=this.m;a=b.indexOf(a);if(-1===a)return!1;a===b.length-1?b.pop():b.splice(a,1);this.qb();return!0};t.delete=function(a){return this.remove(a)};
t.kb=function(a){G&&E(a,H,"removeAt:i");var b=this.m;(0>a||a>=b.length)&&Ba(a,"0 <= i < length",H,"removeAt:i");this.u&&xa(this,a);a===b.length-1?b.pop():b.splice(a,1);this.qb()};t.removeRange=function(a,b){G&&(E(a,H,"removeRange:from"),E(b,H,"removeRange:to"));var c=this.m,d=c.length;if(0>a)a=0;else if(a>=d)return this;if(0>b)return this;b>=d&&(b=d-1);if(a>b)return this;this.u&&xa(this);for(var e=a,f=b+1;f<d;)c[e++]=c[f++];c.length=d-(b-a+1);this.qb();return this};
H.prototype.copy=function(){var a=new H,b=this.m;0<b.length&&(a.m=Array.prototype.slice.call(b));return a};t=H.prototype;t.Fa=function(){for(var a=this.m,b=this.count,c=Array(b),d=0;d<b;d++)c[d]=a[d];return c};t.dw=function(){for(var a=new I,b=this.m,c=this.count,d=0;d<c;d++)a.add(b[d]);return a};t.sort=function(a){G&&A(a,"function",H,"sort:sortfunc");this.u&&xa(this);this.m.sort(a);this.qb();return this};
t.gj=function(a,b,c){var d=this.m,e=d.length;void 0===b&&(b=0);void 0===c&&(c=e);G&&(A(a,"function",H,"sortRange:sortfunc"),E(b,H,"sortRange:from"),E(c,H,"sortRange:to"));this.u&&xa(this);var f=c-b;if(1>=f)return this;(0>b||b>=e-1)&&Ba(b,"0 <= from < length",H,"sortRange:from");if(2===f)return c=d[b],e=d[b+1],0<a(c,e)&&(d[b]=e,d[b+1]=c,this.qb()),this;if(0===b)if(c>=e)d.sort(a);else for(b=d.slice(0,c),b.sort(a),a=0;a<c;a++)d[a]=b[a];else if(c>=e)for(c=d.slice(b),c.sort(a),a=b;a<e;a++)d[a]=c[a-b];
else for(e=d.slice(b,c),e.sort(a),a=b;a<c;a++)d[a]=e[a-b];this.qb();return this};t.reverse=function(){this.u&&xa(this);this.m.reverse();this.qb();return this};
na.Object.defineProperties(H.prototype,{_dataArray:{configurable:!0,get:function(){return this.m}},count:{configurable:!0,get:function(){return this.m.length}},size:{configurable:!0,get:function(){return this.m.length}},length:{configurable:!0,get:function(){return this.m.length}},iterator:{configurable:!0,get:function(){if(0>=this.m.length)return hb;var a=this.Oa;return null!==a?(a.reset(),a):new jb(this)}},iteratorBackwards:{configurable:!0,
enumerable:!0,get:function(){if(0>=this.m.length)return hb;var a=this.eh;return null!==a?(a.reset(),a):new kb(this)}}});H.prototype.reverse=H.prototype.reverse;H.prototype.sortRange=H.prototype.gj;H.prototype.sort=H.prototype.sort;H.prototype.toSet=H.prototype.dw;H.prototype.toArray=H.prototype.Fa;H.prototype.removeRange=H.prototype.removeRange;H.prototype.removeAt=H.prototype.kb;H.prototype["delete"]=H.prototype.delete;H.prototype.remove=H.prototype.remove;H.prototype.insertAt=H.prototype.Bb;
H.prototype.pop=H.prototype.pop;H.prototype.last=H.prototype.fc;H.prototype.first=H.prototype.first;H.prototype.set=H.prototype.set;H.prototype.setElt=H.prototype.Vc;H.prototype.get=H.prototype.get;H.prototype.elt=H.prototype.M;H.prototype.indexOf=H.prototype.indexOf;H.prototype.has=H.prototype.has;H.prototype.contains=H.prototype.contains;H.prototype.clear=H.prototype.clear;H.prototype.addAll=H.prototype.addAll;H.prototype.push=H.prototype.push;H.prototype.add=H.prototype.add;H.prototype.thaw=H.prototype.ka;
H.prototype.freeze=H.prototype.freeze;H.className="List";function mb(a){this.rg=a;a.Oa=null;this.oa=a.w;this.qa=null}mb.prototype.reset=function(){var a=this.rg;a.Oa=null;this.oa=a.w;this.qa=null};mb.prototype.next=function(){var a=this.rg;if(a.w!==this.oa){if(null===this.key)return!1;Da(a)}var b=this.qa;b=null===b?a.ga:b.ua;if(null!==b)return this.qa=b,this.value=b.value,this.key=b.key,!0;this.Zd();return!1};mb.prototype.xd=function(){return this.next()};
mb.prototype.first=function(){var a=this.rg;this.oa=a.w;a=a.ga;if(null!==a){this.qa=a;var b=a.value;this.key=a.key;return this.value=b}return null};mb.prototype.any=function(a){var b=this.rg;b.Oa=null;var c=b.w;this.qa=null;for(var d=b.ga;null!==d;){if(a(d.value))return!0;b.w!==c&&Da(b);d=d.ua}return!1};mb.prototype.all=function(a){var b=this.rg;b.Oa=null;var c=b.w;this.qa=null;for(var d=b.ga;null!==d;){if(!a(d.value))return!1;b.w!==c&&Da(b);d=d.ua}return!0};
mb.prototype.each=function(a){var b=this.rg;b.Oa=null;var c=b.w;this.qa=null;for(var d=b.ga;null!==d;)a(d.value),b.w!==c&&Da(b),d=d.ua;return this};mb.prototype.map=function(a){var b=this.rg;b.Oa=null;for(var c=new H,d=b.w,e=b.ga;null!==e;)c.add(a(e.value)),b.w!==d&&Da(b),e=e.ua;return c.iterator};mb.prototype.filter=function(a){var b=this.rg;b.Oa=null;for(var c=new H,d=b.w,e=b.ga;null!==e;){var f=e.value;a(f)&&c.add(f);b.w!==d&&Da(b);e=e.ua}return c.iterator};
mb.prototype.Zd=function(){this.value=this.key=null;this.oa=-1;this.rg.Oa=this};mb.prototype.toString=function(){return null!==this.qa?"SetIterator@"+this.qa.value:"SetIterator"};na.Object.defineProperties(mb.prototype,{iterator:{configurable:!0,get:function(){return this}},count:{configurable:!0,get:function(){return this.rg.Ob}}});mb.prototype.first=mb.prototype.first;mb.prototype.hasNext=mb.prototype.xd;mb.prototype.next=mb.prototype.next;mb.prototype.reset=mb.prototype.reset;
mb.className="SetIterator";function I(a){ab(this);this.u=!1;this.Pb={};this.Ob=0;this.Oa=null;this.w=0;this.mf=this.ga=null;(G&&"function"===typeof a||"string"===typeof a)&&v("Error: Since 2.0 List/Map/Set constructors no longer take an argument that enforces type.");void 0!==a&&this.addAll(a)}t=I.prototype;t.qb=function(){var a=this.w;a++;999999999<a&&(a=0);this.w=a};t.freeze=function(){this.u=!0;return this};t.ka=function(){this.u=!1;return this};t.toString=function(){return"Set()#"+lb(this)};
t.add=function(a){if(null===a)return this;this.u&&xa(this,a);var b=a;Ga(a)&&(b=nb(a));void 0===this.Pb[b]&&(this.Ob++,a=new ob(a,a),this.Pb[b]=a,b=this.mf,null===b?this.ga=a:(a.Il=b,b.ua=a),this.mf=a,this.qb());return this};t.addAll=function(a){if(null===a)return this;this.u&&xa(this);if(Ha(a))for(var b=a.length,c=0;c<b;c++)this.add(a[c]);else for(a=a.iterator;a.next();)this.add(a.value);return this};
t.contains=function(a){if(null===a)return!1;var b=a;return Ga(a)&&(b=lb(a),void 0===b)?!1:void 0!==this.Pb[b]};t.has=function(a){return this.contains(a)};t.Gz=function(a){if(null===a)return!0;for(a=a.iterator;a.next();)if(!this.contains(a.value))return!1;return!0};t.Hz=function(a){if(null===a)return!0;for(a=a.iterator;a.next();)if(this.contains(a.value))return!0;return!1};t.first=function(){var a=this.ga;return null===a?null:a.value};
I.prototype.any=function(a){for(var b=this.w,c=this.ga;null!==c;){if(a(c.value))return!0;this.w!==b&&Da(this);c=c.ua}return!1};I.prototype.all=function(a){for(var b=this.w,c=this.ga;null!==c;){if(!a(c.value))return!1;this.w!==b&&Da(this);c=c.ua}return!0};I.prototype.each=function(a){for(var b=this.w,c=this.ga;null!==c;)a(c.value),this.w!==b&&Da(this),c=c.ua;return this};I.prototype.map=function(a){for(var b=new I,c=this.w,d=this.ga;null!==d;)b.add(a(d.value)),this.w!==c&&Da(this),d=d.ua;return b};
I.prototype.filter=function(a){for(var b=new I,c=this.w,d=this.ga;null!==d;){var e=d.value;a(e)&&b.add(e);this.w!==c&&Da(this);d=d.ua}return b};t=I.prototype;t.remove=function(a){if(null===a)return!1;this.u&&xa(this,a);var b=a;if(Ga(a)&&(b=lb(a),void 0===b))return!1;a=this.Pb[b];if(void 0===a)return!1;var c=a.ua,d=a.Il;null!==c&&(c.Il=d);null!==d&&(d.ua=c);this.ga===a&&(this.ga=c);this.mf===a&&(this.mf=d);delete this.Pb[b];this.Ob--;this.qb();return!0};t.delete=function(a){return this.remove(a)};
t.Cq=function(a){if(null===a)return this;this.u&&xa(this);if(Ha(a))for(var b=a.length,c=0;c<b;c++)this.remove(a[c]);else for(a=a.iterator;a.next();)this.remove(a.value);return this};t.dB=function(a){if(null===a||0===this.count)return this;this.u&&xa(this);var b=new I;b.addAll(a);a=[];for(var c=this.iterator;c.next();){var d=c.value;b.contains(d)||a.push(d)}this.Cq(a);return this};t.clear=function(){this.u&&xa(this);this.Pb={};this.Ob=0;null!==this.Oa&&this.Oa.reset();this.mf=this.ga=null;this.qb()};
I.prototype.copy=function(){var a=new I,b=this.Pb,c;for(c in b)a.add(b[c].value);return a};I.prototype.Fa=function(){var a=Array(this.Ob),b=this.Pb,c=0,d;for(d in b)a[c]=b[d].value,c++;return a};I.prototype.cw=function(){var a=new H,b=this.Pb,c;for(c in b)a.add(b[c].value);return a};function ab(a){a.__gohashid=qb++}function nb(a){var b=a.__gohashid;void 0===b&&(b=qb++,a.__gohashid=b);return b}function lb(a){return a.__gohashid}
na.Object.defineProperties(I.prototype,{count:{configurable:!0,get:function(){return this.Ob}},size:{configurable:!0,get:function(){return this.Ob}},iterator:{configurable:!0,get:function(){if(0>=this.Ob)return hb;var a=this.Oa;return null!==a?(a.reset(),a):new mb(this)}}});I.prototype.toList=I.prototype.cw;I.prototype.toArray=I.prototype.Fa;I.prototype.clear=I.prototype.clear;I.prototype.retainAll=I.prototype.dB;I.prototype.removeAll=I.prototype.Cq;
I.prototype["delete"]=I.prototype.delete;I.prototype.remove=I.prototype.remove;I.prototype.first=I.prototype.first;I.prototype.containsAny=I.prototype.Hz;I.prototype.containsAll=I.prototype.Gz;I.prototype.has=I.prototype.has;I.prototype.contains=I.prototype.contains;I.prototype.addAll=I.prototype.addAll;I.prototype.add=I.prototype.add;I.prototype.thaw=I.prototype.ka;I.prototype.freeze=I.prototype.freeze;var qb=1;I.className="Set";I.uniqueHash=ab;I.hashIdUnique=nb;I.hashId=lb;
function rb(a){this.ma=a;this.oa=a.w;this.qa=null}rb.prototype.reset=function(){this.oa=this.ma.w;this.qa=null};rb.prototype.next=function(){var a=this.ma;if(a.w!==this.oa){if(null===this.key)return!1;Da(a)}var b=this.qa;b=null===b?a.ga:b.ua;if(null!==b)return this.qa=b,this.value=this.key=a=b.key,!0;this.Zd();return!1};rb.prototype.xd=function(){return this.next()};rb.prototype.first=function(){var a=this.ma;this.oa=a.w;a=a.ga;return null!==a?(this.qa=a,this.value=this.key=a=a.key):null};
rb.prototype.any=function(a){var b=this.ma,c=b.w;this.qa=null;for(var d=b.ga;null!==d;){if(a(d.key))return!0;b.w!==c&&Da(b);d=d.ua}return!1};rb.prototype.all=function(a){var b=this.ma,c=b.w;this.qa=null;for(var d=b.ga;null!==d;){if(!a(d.key))return!1;b.w!==c&&Da(b);d=d.ua}return!0};rb.prototype.each=function(a){var b=this.ma,c=b.w;this.qa=null;for(var d=b.ga;null!==d;)a(d.key),b.w!==c&&Da(b),d=d.ua;return this};
rb.prototype.map=function(a){var b=this.ma,c=b.w;this.qa=null;for(var d=new H,e=b.ga;null!==e;)d.add(a(e.key)),b.w!==c&&Da(b),e=e.ua;return d.iterator};rb.prototype.filter=function(a){var b=this.ma,c=b.w;this.qa=null;for(var d=new H,e=b.ga;null!==e;){var f=e.key;a(f)&&d.add(f);b.w!==c&&Da(b);e=e.ua}return d.iterator};rb.prototype.Zd=function(){this.value=this.key=null;this.oa=-1};rb.prototype.toString=function(){return null!==this.qa?"MapKeySetIterator@"+this.qa.value:"MapKeySetIterator"};
na.Object.defineProperties(rb.prototype,{iterator:{configurable:!0,get:function(){return this}},count:{configurable:!0,get:function(){return this.ma.Ob}}});rb.prototype.first=rb.prototype.first;rb.prototype.hasNext=rb.prototype.xd;rb.prototype.next=rb.prototype.next;rb.prototype.reset=rb.prototype.reset;rb.className="MapKeySetIterator";function tb(a){I.call(this);ab(this);this.u=!0;this.ma=a}ma(tb,I);t=tb.prototype;t.freeze=function(){return this};t.ka=function(){return this};
t.toString=function(){return"MapKeySet("+this.ma.toString()+")"};t.add=function(){v("This Set is read-only: "+this.toString())};t.contains=function(a){return this.ma.contains(a)};t.has=function(a){return this.contains(a)};t.remove=function(){v("This Set is read-only: "+this.toString())};t.delete=function(a){return this.remove(a)};t.clear=function(){v("This Set is read-only: "+this.toString())};t.first=function(){var a=this.ma.ga;return null!==a?a.key:null};
tb.prototype.any=function(a){for(var b=this.ma.ga;null!==b;){if(a(b.key))return!0;b=b.ua}return!1};tb.prototype.all=function(a){for(var b=this.ma.ga;null!==b;){if(!a(b.key))return!1;b=b.ua}return!0};tb.prototype.each=function(a){for(var b=this.ma.ga;null!==b;)a(b.key),b=b.ua;return this};tb.prototype.map=function(a){for(var b=new I,c=this.ma.ga;null!==c;)b.add(a(c.key)),c=c.ua;return b};tb.prototype.filter=function(a){for(var b=new I,c=this.ma.ga;null!==c;){var d=c.key;a(d)&&b.add(d);c=c.ua}return b};
tb.prototype.copy=function(){return new tb(this.ma)};tb.prototype.dw=function(){var a=new I,b=this.ma.Pb,c;for(c in b)a.add(b[c].key);return a};tb.prototype.Fa=function(){var a=this.ma.Pb,b=Array(this.ma.Ob),c=0,d;for(d in a)b[c]=a[d].key,c++;return b};tb.prototype.cw=function(){var a=new H,b=this.ma.Pb,c;for(c in b)a.add(b[c].key);return a};
na.Object.defineProperties(tb.prototype,{count:{configurable:!0,get:function(){return this.ma.Ob}},size:{configurable:!0,get:function(){return this.ma.Ob}},iterator:{configurable:!0,get:function(){return 0>=this.ma.Ob?hb:new rb(this.ma)}}});tb.prototype.toList=tb.prototype.cw;tb.prototype.toArray=tb.prototype.Fa;tb.prototype.toSet=tb.prototype.dw;tb.prototype.first=tb.prototype.first;tb.prototype.clear=tb.prototype.clear;tb.prototype["delete"]=tb.prototype.delete;
tb.prototype.remove=tb.prototype.remove;tb.prototype.has=tb.prototype.has;tb.prototype.contains=tb.prototype.contains;tb.prototype.add=tb.prototype.add;tb.prototype.thaw=tb.prototype.ka;tb.prototype.freeze=tb.prototype.freeze;tb.className="MapKeySet";function ub(a){this.ma=a;a.lf=null;this.oa=a.w;this.qa=null}ub.prototype.reset=function(){var a=this.ma;a.lf=null;this.oa=a.w;this.qa=null};
ub.prototype.next=function(){var a=this.ma;if(a.w!==this.oa){if(null===this.key)return!1;Da(a)}var b=this.qa;b=null===b?a.ga:b.ua;if(null!==b)return this.qa=b,this.value=b.value,this.key=b.key,!0;this.Zd();return!1};ub.prototype.xd=function(){return this.next()};ub.prototype.first=function(){var a=this.ma;this.oa=a.w;a=a.ga;if(null!==a){this.qa=a;var b=a.value;this.key=a.key;return this.value=b}return null};
ub.prototype.any=function(a){var b=this.ma;b.lf=null;var c=b.w;this.qa=null;for(var d=b.ga;null!==d;){if(a(d.value))return!0;b.w!==c&&Da(b);d=d.ua}return!1};ub.prototype.all=function(a){var b=this.ma;b.lf=null;var c=b.w;this.qa=null;for(var d=b.ga;null!==d;){if(!a(d.value))return!1;b.w!==c&&Da(b);d=d.ua}return!0};ub.prototype.each=function(a){var b=this.ma;b.lf=null;var c=b.w;this.qa=null;for(var d=b.ga;null!==d;)a(d.value),b.w!==c&&Da(b),d=d.ua;return this};
ub.prototype.map=function(a){var b=this.ma;b.lf=null;var c=b.w;this.qa=null;for(var d=new H,e=b.ga;null!==e;)d.add(a(e.value)),b.w!==c&&Da(b),e=e.ua;return d.iterator};ub.prototype.filter=function(a){var b=this.ma;b.lf=null;var c=b.w;this.qa=null;for(var d=new H,e=b.ga;null!==e;){var f=e.value;a(f)&&d.add(f);b.w!==c&&Da(b);e=e.ua}return d.iterator};ub.prototype.Zd=function(){this.value=this.key=null;this.oa=-1;this.ma.lf=this};
ub.prototype.toString=function(){return null!==this.qa?"MapValueSetIterator@"+this.qa.value:"MapValueSetIterator"};na.Object.defineProperties(ub.prototype,{iterator:{configurable:!0,get:function(){return this}},count:{configurable:!0,get:function(){return this.ma.Ob}}});ub.prototype.first=ub.prototype.first;ub.prototype.hasNext=ub.prototype.xd;ub.prototype.next=ub.prototype.next;ub.prototype.reset=ub.prototype.reset;ub.className="MapValueSetIterator";
function ob(a,b){this.key=a;this.value=b;this.Il=this.ua=null}ob.prototype.toString=function(){return"{"+this.key+":"+this.value+"}"};ob.className="KeyValuePair";function xb(a){this.ma=a;a.Oa=null;this.oa=a.w;this.qa=null}xb.prototype.reset=function(){var a=this.ma;a.Oa=null;this.oa=a.w;this.qa=null};
xb.prototype.next=function(){var a=this.ma;if(a.w!==this.oa){if(null===this.key)return!1;Da(a)}var b=this.qa;b=null===b?a.ga:b.ua;if(null!==b)return this.qa=b,this.key=b.key,this.value=b.value,!0;this.Zd();return!1};xb.prototype.xd=function(){return this.next()};xb.prototype.first=function(){var a=this.ma;this.oa=a.w;a=a.ga;return null!==a?(this.qa=a,this.key=a.key,this.value=a.value,a):null};
xb.prototype.any=function(a){var b=this.ma;b.Oa=null;var c=b.w;this.qa=null;for(var d=b.ga;null!==d;){if(a(d))return!0;b.w!==c&&Da(b);d=d.ua}return!1};xb.prototype.all=function(a){var b=this.ma;b.Oa=null;var c=b.w;this.qa=null;for(var d=b.ga;null!==d;){if(!a(d))return!1;b.w!==c&&Da(b);d=d.ua}return!0};xb.prototype.each=function(a){var b=this.ma;b.Oa=null;var c=b.w;this.qa=null;for(var d=b.ga;null!==d;)a(d),b.w!==c&&Da(b),d=d.ua;return this};
xb.prototype.map=function(a){var b=this.ma;b.Oa=null;var c=b.w;this.qa=null;for(var d=new H,e=b.ga;null!==e;)d.add(a(e)),b.w!==c&&Da(b),e=e.ua;return d.iterator};xb.prototype.filter=function(a){var b=this.ma;b.Oa=null;var c=b.w;this.qa=null;for(var d=new H,e=b.ga;null!==e;)a(e)&&d.add(e),b.w!==c&&Da(b),e=e.ua;return d.iterator};xb.prototype.Zd=function(){this.value=this.key=null;this.oa=-1;this.ma.Oa=this};xb.prototype.toString=function(){return null!==this.qa?"MapIterator@"+this.qa:"MapIterator"};
na.Object.defineProperties(xb.prototype,{iterator:{configurable:!0,get:function(){return this}},count:{configurable:!0,get:function(){return this.ma.Ob}}});xb.prototype.first=xb.prototype.first;xb.prototype.hasNext=xb.prototype.xd;xb.prototype.next=xb.prototype.next;xb.prototype.reset=xb.prototype.reset;xb.className="MapIterator";
function yb(a){ab(this);this.u=!1;this.Pb={};this.Ob=0;this.lf=this.Oa=null;this.w=0;this.mf=this.ga=null;(G&&"function"===typeof a||"string"===typeof a)&&v("Error: Since 2.0 List/Map/Set constructors no longer take an argument that enforces type.");void 0!==a&&this.addAll(a)}t=yb.prototype;t.qb=function(){var a=this.w;a++;999999999<a&&(a=0);this.w=a};t.freeze=function(){this.u=!0;return this};t.ka=function(){this.u=!1;return this};t.toString=function(){return"Map()#"+lb(this)};
t.add=function(a,b){this.u&&xa(this,a);var c=a;Ga(a)&&(c=nb(a));var d=this.Pb[c];void 0===d?(this.Ob++,a=new ob(a,b),this.Pb[c]=a,c=this.mf,null===c?this.ga=a:(a.Il=c,c.ua=a),this.mf=a,this.qb()):d.value=b;return this};t.set=function(a,b){return this.add(a,b)};
t.addAll=function(a){if(null===a)return this;if(Ha(a))for(var b=a.length,c=0;c<b;c++){var d=a[c];this.add(d.key,d.value)}else if(a instanceof yb)for(a=a.iterator;a.next();)this.add(a.key,a.value);else for(a=a.iterator;a.next();)b=a.value,this.add(b.key,b.value);return this};t.first=function(){return this.ga};yb.prototype.any=function(a){for(var b=this.w,c=this.ga;null!==c;){if(a(c))return!0;this.w!==b&&Da(this);c=c.ua}return!1};
yb.prototype.all=function(a){for(var b=this.w,c=this.ga;null!==c;){if(!a(c))return!1;this.w!==b&&Da(this);c=c.ua}return!0};yb.prototype.each=function(a){for(var b=this.w,c=this.ga;null!==c;)a(c),this.w!==b&&Da(this),c=c.ua;return this};yb.prototype.map=function(a){for(var b=new yb,c=this.w,d=this.ga;null!==d;)b.add(d.key,a(d)),this.w!==c&&Da(this),d=d.ua;return b};yb.prototype.filter=function(a){for(var b=new yb,c=this.w,d=this.ga;null!==d;)a(d)&&b.add(d.key,d.value),this.w!==c&&Da(this),d=d.ua;return b};
t=yb.prototype;t.contains=function(a){var b=a;return Ga(a)&&(b=lb(a),void 0===b)?!1:void 0!==this.Pb[b]};t.has=function(a){return this.contains(a)};t.K=function(a){var b=a;if(Ga(a)&&(b=lb(a),void 0===b))return null;a=this.Pb[b];return void 0===a?null:a.value};t.get=function(a){return this.K(a)};
t.remove=function(a){if(null===a)return!1;this.u&&xa(this,a);var b=a;if(Ga(a)&&(b=lb(a),void 0===b))return!1;a=this.Pb[b];if(void 0===a)return!1;var c=a.ua,d=a.Il;null!==c&&(c.Il=d);null!==d&&(d.ua=c);this.ga===a&&(this.ga=c);this.mf===a&&(this.mf=d);delete this.Pb[b];this.Ob--;this.qb();return!0};t.delete=function(a){return this.remove(a)};t.clear=function(){this.u&&xa(this);this.Pb={};this.Ob=0;null!==this.Oa&&this.Oa.reset();null!==this.lf&&this.lf.reset();this.mf=this.ga=null;this.qb()};
yb.prototype.copy=function(){var a=new yb,b=this.Pb,c;for(c in b){var d=b[c];a.add(d.key,d.value)}return a};yb.prototype.Fa=function(){var a=this.Pb,b=Array(this.Ob),c=0,d;for(d in a){var e=a[d];b[c]=new ob(e.key,e.value);c++}return b};yb.prototype.Uf=function(){return new tb(this)};
na.Object.defineProperties(yb.prototype,{count:{configurable:!0,get:function(){return this.Ob}},size:{configurable:!0,get:function(){return this.Ob}},iterator:{configurable:!0,get:function(){if(0>=this.count)return hb;var a=this.Oa;return null!==a?(a.reset(),a):new xb(this)}},iteratorKeys:{configurable:!0,get:function(){return 0>=this.count?hb:new rb(this)}},iteratorValues:{configurable:!0,get:function(){if(0>=this.count)return hb;
var a=this.lf;return null!==a?(a.reset(),a):new ub(this)}}});yb.prototype.toKeySet=yb.prototype.Uf;yb.prototype.toArray=yb.prototype.Fa;yb.prototype.clear=yb.prototype.clear;yb.prototype["delete"]=yb.prototype.delete;yb.prototype.remove=yb.prototype.remove;yb.prototype.get=yb.prototype.get;yb.prototype.getValue=yb.prototype.K;yb.prototype.has=yb.prototype.has;yb.prototype.contains=yb.prototype.contains;yb.prototype.first=yb.prototype.first;yb.prototype.addAll=yb.prototype.addAll;
yb.prototype.set=yb.prototype.set;yb.prototype.add=yb.prototype.add;yb.prototype.thaw=yb.prototype.ka;yb.prototype.freeze=yb.prototype.freeze;yb.className="Map";function K(a,b){void 0===a?this.J=this.I=0:"number"===typeof a&&"number"===typeof b?(this.I=a,this.J=b):v("Invalid arguments to Point constructor: "+a+", "+b);this.u=!1}var zb,Ab,Bb,Cb,Db;K.prototype.assign=function(a){this.I=a.I;this.J=a.J;return this};K.prototype.h=function(a,b){this.I=a;this.J=b;return this};
K.prototype.Eg=function(a,b){G&&(A(a,"number",K,"setTo:x"),A(b,"number",K,"setTo:y"),this.ha());this.I=a;this.J=b;return this};K.prototype.set=function(a){G&&(w(a,K,K,"set:p"),this.ha());this.I=a.I;this.J=a.J;return this};K.prototype.copy=function(){var a=new K;a.I=this.I;a.J=this.J;return a};t=K.prototype;t.ia=function(){this.u=!0;Object.freeze(this);return this};t.L=function(){return this.u||Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.u=!0;return this};
t.ka=function(){Object.isFrozen(this)&&v("cannot thaw constant: "+this);this.u=!1;return this};t.ha=function(a){if(G&&this.u){var b="The Point is frozen, so its properties cannot be set: "+this.toString();void 0!==a&&(b+="  to value: "+a);v(b)}};function Eb(a){if("string"===typeof a){a=a.split(" ");for(var b=0,c=0;""===a[b];)b++;var d=a[b++];d&&(c=parseFloat(d));for(var e=0;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));return new K(c,e)}return new K}
function Fb(a){G&&w(a,K);return a.x.toString()+" "+a.y.toString()}t.toString=function(){return"Point("+this.x+","+this.y+")"};t.B=function(a){return a instanceof K?this.I===a.x&&this.J===a.y:!1};t.Qi=function(a,b){return this.I===a&&this.J===b};t.Za=function(a){return L.A(this.I,a.x)&&L.A(this.J,a.y)};t.add=function(a){G&&(w(a,K,K,"add:p"),this.ha());this.I+=a.x;this.J+=a.y;return this};t.qe=function(a){G&&(w(a,K,K,"subtract:p"),this.ha());this.I-=a.x;this.J-=a.y;return this};
t.offset=function(a,b){G&&(E(a,K,"offset:dx"),E(b,K,"offset:dy"),this.ha());this.I+=a;this.J+=b;return this};K.prototype.rotate=function(a){G&&(E(a,K,"rotate:angle"),this.ha());if(0===a)return this;var b=this.I,c=this.J;if(0===b&&0===c)return this;360<=a?a-=360:0>a&&(a+=360);if(90===a){a=0;var d=1}else 180===a?(a=-1,d=0):270===a?(a=0,d=-1):(d=a*Math.PI/180,a=Math.cos(d),d=Math.sin(d));this.I=a*b-d*c;this.J=d*b+a*c;return this};t=K.prototype;
t.scale=function(a,b){G&&(E(a,K,"scale:sx"),E(b,K,"scale:sy"),this.ha());this.I*=a;this.J*=b;return this};t.Jf=function(a){G&&w(a,K,K,"distanceSquaredPoint:p");var b=a.x-this.I;a=a.y-this.J;return b*b+a*a};t.wd=function(a,b){G&&(E(a,K,"distanceSquared:px"),E(b,K,"distanceSquared:py"));a-=this.I;b-=this.J;return a*a+b*b};t.normalize=function(){G&&this.ha();var a=this.I,b=this.J,c=Math.sqrt(a*a+b*b);0<c&&(this.I=a/c,this.J=b/c);return this};
t.Va=function(a){G&&w(a,K,K,"directionPoint:p");return Gb(a.x-this.I,a.y-this.J)};t.direction=function(a,b){G&&(E(a,K,"direction:px"),E(b,K,"direction:py"));return Gb(a-this.I,b-this.J)};function Gb(a,b){if(0===a)return 0<b?90:0>b?270:0;if(0===b)return 0<a?0:180;if(isNaN(a)||isNaN(b))return 0;var c=180*Math.atan(Math.abs(b/a))/Math.PI;0>a?c=0>b?c+180:180-c:0>b&&(c=360-c);return c}
t.Fz=function(a,b){G&&(w(a,K,K,"compareWithLineSegmentPoint:p"),w(b,K,K,"compareWithLineSegmentPoint:q"));return L.im(a.x,a.y,b.x,b.y,this.x,this.y)};t.UA=function(a,b,c,d){G&&(E(a,K,"projectOntoLineSegment:px"),E(b,K,"projectOntoLineSegment:py"),E(c,K,"projectOntoLineSegment:qx"),E(d,K,"projectOntoLineSegment:qy"));L.Th(a,b,c,d,this.I,this.J,this);return this};
t.VA=function(a,b){G&&(w(a,K,K,"projectOntoLineSegmentPoint:p"),w(b,K,K,"projectOntoLineSegmentPoint:q"));L.Th(a.x,a.y,b.x,b.y,this.I,this.J,this);return this};t.iB=function(a,b,c,d){G&&(E(a,K,"snapToGrid:originx"),E(b,K,"snapToGrid:originy"),E(c,K,"snapToGrid:cellwidth"),E(d,K,"snapToGrid:cellheight"));L.jq(this.I,this.J,a,b,c,d,this);return this};t.jB=function(a,b){G&&(w(a,K,K,"snapToGridPoint:p"),w(b,Hb,K,"snapToGridPoint:q"));L.jq(this.I,this.J,a.x,a.y,b.width,b.height,this);return this};
t.ej=function(a,b){G&&(w(a,M,K,"setRectSpot:r"),w(b,Ib,K,"setRectSpot:spot"),this.ha());this.I=a.x+b.x*a.width+b.offsetX;this.J=a.y+b.y*a.height+b.offsetY;return this};t.fj=function(a,b,c,d,e){G&&(E(a,K,"setSpot:x"),E(b,K,"setSpot:y"),E(c,K,"setSpot:w"),E(d,K,"setSpot:h"),(0>c||0>d)&&v("Point.setSpot:Width and height cannot be negative"),w(e,Ib,K,"setSpot:spot"),this.ha());this.I=a+e.x*c+e.offsetX;this.J=b+e.y*d+e.offsetY;return this};
t.transform=function(a){G&&w(a,Jb,K,"transform:t");a.Ga(this);return this};function Kb(a,b){G&&w(b,Jb,K,"transformInverted:t");b.Od(a);return a}
function Lb(a,b,c,d,e,f){G&&(E(a,K,"distanceLineSegmentSquared:px"),E(b,K,"distanceLineSegmentSquared:py"),E(c,K,"distanceLineSegmentSquared:ax"),E(d,K,"distanceLineSegmentSquared:ay"),E(e,K,"distanceLineSegmentSquared:bx"),E(f,K,"distanceLineSegmentSquared:by"));var g=e-c,h=f-d,k=g*g+h*h;c-=a;d-=b;var l=-c*g-d*h;if(0>=l||l>=k)return g=e-a,h=f-b,Math.min(c*c+d*d,g*g+h*h);a=g*d-h*c;return a*a/k}
function Mb(a,b,c,d){G&&(E(a,K,"distanceSquared:px"),E(b,K,"distanceSquared:py"),E(c,K,"distanceSquared:qx"),E(d,K,"distanceSquared:qy"));a=c-a;b=d-b;return a*a+b*b}function Nb(a,b,c,d){G&&(E(a,K,"direction:px"),E(b,K,"direction:py"),E(c,K,"direction:qx"),E(d,K,"direction:qy"));a=c-a;b=d-b;if(0===a)return 0<b?90:0>b?270:0;if(0===b)return 0<a?0:180;if(isNaN(a)||isNaN(b))return 0;d=180*Math.atan(Math.abs(b/a))/Math.PI;0>a?d=0>b?d+180:180-d:0>b&&(d=360-d);return d}
t.s=function(){return isFinite(this.x)&&isFinite(this.y)};K.alloc=function(){var a=Ob.pop();return void 0===a?new K:a};K.allocAt=function(a,b){var c=Ob.pop();if(void 0===c)return new K(a,b);c.x=a;c.y=b;return c};K.free=function(a){Ob.push(a)};
na.Object.defineProperties(K.prototype,{x:{configurable:!0,get:function(){return this.I},set:function(a){G&&(A(a,"number",K,"x"),this.ha(a));this.I=a}},y:{configurable:!0,get:function(){return this.J},set:function(a){G&&(A(a,"number",K,"y"),this.ha(a));this.J=a}}});K.prototype.isReal=K.prototype.s;K.prototype.setSpot=K.prototype.fj;K.prototype.setRectSpot=K.prototype.ej;K.prototype.snapToGridPoint=K.prototype.jB;K.prototype.snapToGrid=K.prototype.iB;
K.prototype.projectOntoLineSegmentPoint=K.prototype.VA;K.prototype.projectOntoLineSegment=K.prototype.UA;K.intersectingLineSegments=function(a,b,c,d,e,f,g,h){G&&(E(a,K,"intersectingLineSegments:a1x"),E(b,K,"intersectingLineSegments:a1y"),E(c,K,"intersectingLineSegments:a2x"),E(d,K,"intersectingLineSegments:a2y"),E(e,K,"intersectingLineSegments:b1x"),E(f,K,"intersectingLineSegments:b1y"),E(g,K,"intersectingLineSegments:b2x"),E(h,K,"intersectingLineSegments:b2y"));return L.pm(a,b,c,d,e,f,g,h)};
K.prototype.compareWithLineSegmentPoint=K.prototype.Fz;K.compareWithLineSegment=function(a,b,c,d,e,f){G&&(E(a,K,"compareWithLineSegment:a1x"),E(b,K,"compareWithLineSegment:a1y"),E(c,K,"compareWithLineSegment:a2x"),E(d,K,"compareWithLineSegment:a2y"),E(e,K,"compareWithLineSegment:b1x"),E(f,K,"compareWithLineSegment:b1y"));return L.im(a,b,c,d,e,f)};K.prototype.direction=K.prototype.direction;K.prototype.directionPoint=K.prototype.Va;K.prototype.normalize=K.prototype.normalize;
K.prototype.distanceSquared=K.prototype.wd;K.prototype.distanceSquaredPoint=K.prototype.Jf;K.prototype.scale=K.prototype.scale;K.prototype.rotate=K.prototype.rotate;K.prototype.offset=K.prototype.offset;K.prototype.subtract=K.prototype.qe;K.prototype.add=K.prototype.add;K.prototype.equalsApprox=K.prototype.Za;K.prototype.equalTo=K.prototype.Qi;K.prototype.equals=K.prototype.B;K.prototype.set=K.prototype.set;K.prototype.setTo=K.prototype.Eg;var Ob=[];K.className="Point";K.parse=Eb;K.stringify=Fb;
K.distanceLineSegmentSquared=Lb;K.distanceSquared=Mb;K.direction=Nb;K.Origin=zb=(new K(0,0)).ia();K.InfiniteTopLeft=Ab=(new K(-Infinity,-Infinity)).ia();K.InfiniteBottomRight=Bb=(new K(Infinity,Infinity)).ia();K.SixPoint=Cb=(new K(6,6)).ia();K.NoPoint=Db=(new K(NaN,NaN)).ia();K.parse=Eb;K.stringify=Fb;K.distanceLineSegmentSquared=Lb;K.distanceSquared=Mb;K.direction=Nb;
function Hb(a,b){void 0===a?this.ea=this.fa=0:"number"===typeof a&&(0<=a||isNaN(a))&&"number"===typeof b&&(0<=b||isNaN(b))?(this.fa=a,this.ea=b):v("Invalid arguments to Size constructor: "+a+", "+b);this.u=!1}var Pb,Qb,Rb,Ub,Vb,Wb,Xb;Hb.prototype.assign=function(a){this.fa=a.fa;this.ea=a.ea;return this};Hb.prototype.h=function(a,b){this.fa=a;this.ea=b;return this};
Hb.prototype.Eg=function(a,b){G&&(A(a,"number",Hb,"setTo:w"),A(b,"number",Hb,"setTo:h"),0>a&&Ba(a,">= 0",Hb,"setTo:w"),0>b&&Ba(b,">= 0",Hb,"setTo:h"),this.ha());this.fa=a;this.ea=b;return this};Hb.prototype.set=function(a){G&&(w(a,Hb,Hb,"set:s"),this.ha());this.fa=a.fa;this.ea=a.ea;return this};Hb.prototype.copy=function(){var a=new Hb;a.fa=this.fa;a.ea=this.ea;return a};t=Hb.prototype;t.ia=function(){this.u=!0;Object.freeze(this);return this};
t.L=function(){return this.u||Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.u=!0;return this};t.ka=function(){Object.isFrozen(this)&&v("cannot thaw constant: "+this);this.u=!1;return this};t.ha=function(a){if(G&&this.u){var b="The Size is frozen, so its properties cannot be set: "+this.toString();void 0!==a&&(b+="  to value: "+a);v(b)}};
function Yb(a){if("string"===typeof a){a=a.split(" ");for(var b=0,c=0;""===a[b];)b++;var d=a[b++];d&&(c=parseFloat(d));for(var e=0;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));return new Hb(c,e)}return new Hb}function Zb(a){G&&w(a,Hb);return a.width.toString()+" "+a.height.toString()}t.toString=function(){return"Size("+this.width+","+this.height+")"};t.B=function(a){return a instanceof Hb?this.fa===a.width&&this.ea===a.height:!1};t.Qi=function(a,b){return this.fa===a&&this.ea===b};
t.Za=function(a){return L.A(this.fa,a.width)&&L.A(this.ea,a.height)};t.s=function(){return isFinite(this.width)&&isFinite(this.height)};Hb.alloc=function(){var a=$b.pop();return void 0===a?new Hb:a};Hb.free=function(a){$b.push(a)};
na.Object.defineProperties(Hb.prototype,{width:{configurable:!0,get:function(){return this.fa},set:function(a){G&&(A(a,"number",Hb,"width"),this.ha(a));0>a&&Ba(a,">= 0",Hb,"width");this.fa=a}},height:{configurable:!0,get:function(){return this.ea},set:function(a){G&&(A(a,"number",Hb,"height"),this.ha(a));0>a&&Ba(a,">= 0",Hb,"height");this.ea=a}}});Hb.prototype.isReal=Hb.prototype.s;Hb.prototype.equalsApprox=Hb.prototype.Za;Hb.prototype.equalTo=Hb.prototype.Qi;
Hb.prototype.equals=Hb.prototype.B;Hb.prototype.set=Hb.prototype.set;Hb.prototype.setTo=Hb.prototype.Eg;var $b=[];Hb.className="Size";Hb.parse=Yb;Hb.stringify=Zb;Hb.ZeroSize=Pb=(new Hb(0,0)).ia();Hb.OneSize=Qb=(new Hb(1,1)).ia();Hb.SixSize=Rb=(new Hb(6,6)).ia();Hb.EightSize=Ub=(new Hb(8,8)).ia();Hb.TenSize=Vb=(new Hb(10,10)).ia();Hb.InfiniteSize=Wb=(new Hb(Infinity,Infinity)).ia();Hb.NoSize=Xb=(new Hb(NaN,NaN)).ia();Hb.parse=Yb;Hb.stringify=Zb;
function M(a,b,c,d){void 0===a?this.ea=this.fa=this.J=this.I=0:"number"===typeof a&&"number"===typeof b&&"number"===typeof c&&(0<=c||isNaN(c))&&"number"===typeof d&&(0<=d||isNaN(d))?(this.I=a,this.J=b,this.fa=c,this.ea=d):a instanceof K?(c=a.x,a=a.y,b instanceof K?(d=b.x,b=b.y,this.I=Math.min(c,d),this.J=Math.min(a,b),this.fa=Math.abs(c-d),this.ea=Math.abs(a-b)):b instanceof Hb?(this.I=c,this.J=a,this.fa=b.width,this.ea=b.height):v("Incorrect second argument supplied to Rect constructor "+b)):v("Invalid arguments to Rect constructor: "+
a+", "+b+", "+c+", "+d);this.u=!1}t=M.prototype;t.assign=function(a){this.I=a.I;this.J=a.J;this.fa=a.fa;this.ea=a.ea;return this};t.h=function(a,b,c,d){this.I=a;this.J=b;this.fa=c;this.ea=d;return this};function ac(a,b,c){a.fa=b;a.ea=c}t.Eg=function(a,b,c,d){G&&(A(a,"number",M,"setTo:x"),A(b,"number",M,"setTo:y"),A(c,"number",M,"setTo:w"),A(d,"number",M,"setTo:h"),0>c&&Ba(c,">= 0",M,"setTo:w"),0>d&&Ba(d,">= 0",M,"setTo:h"),this.ha());this.I=a;this.J=b;this.fa=c;this.ea=d;return this};
t.set=function(a){G&&(w(a,M,M,"set:r"),this.ha());this.I=a.I;this.J=a.J;this.fa=a.fa;this.ea=a.ea;return this};t.Wc=function(a){G&&(w(a,K,M,"setPoint:p"),this.ha());this.I=a.x;this.J=a.y;return this};t.hB=function(a){G&&(w(a,Hb,M,"setSize:s"),this.ha());this.fa=a.width;this.ea=a.height;return this};M.prototype.copy=function(){var a=new M;a.I=this.I;a.J=this.J;a.fa=this.fa;a.ea=this.ea;return a};t=M.prototype;t.ia=function(){this.u=!0;Object.freeze(this);return this};
t.L=function(){return this.u||Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.u=!0;return this};t.ka=function(){Object.isFrozen(this)&&v("cannot thaw constant: "+this);this.u=!1;return this};t.ha=function(a){if(G&&this.u){var b="The Rect is frozen, so its properties cannot be set: "+this.toString();void 0!==a&&(b+="  to value: "+a);v(b)}};
function bc(a){if("string"===typeof a){a=a.split(" ");for(var b=0,c=0;""===a[b];)b++;var d=a[b++];d&&(c=parseFloat(d));for(var e=0;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));for(var f=0;""===a[b];)b++;(d=a[b++])&&(f=parseFloat(d));for(var g=0;""===a[b];)b++;(d=a[b++])&&(g=parseFloat(d));return new M(c,e,f,g)}return new M}function cc(a){G&&w(a,M);return a.x.toString()+" "+a.y.toString()+" "+a.width.toString()+" "+a.height.toString()}
t.toString=function(){return"Rect("+this.x+","+this.y+","+this.width+","+this.height+")"};t.B=function(a){return a instanceof M?this.I===a.x&&this.J===a.y&&this.fa===a.width&&this.ea===a.height:!1};t.Qi=function(a,b,c,d){return this.I===a&&this.J===b&&this.fa===c&&this.ea===d};t.Za=function(a){return L.A(this.I,a.x)&&L.A(this.J,a.y)&&L.A(this.fa,a.width)&&L.A(this.ea,a.height)};function dc(a,b){return L.da(a.I,b.x)&&L.da(a.J,b.y)&&L.da(a.fa,b.width)&&L.da(a.ea,b.height)}
t.ca=function(a){G&&w(a,K,M,"containsPoint:p");return this.I<=a.x&&this.I+this.fa>=a.x&&this.J<=a.y&&this.J+this.ea>=a.y};t.Te=function(a){G&&w(a,M,M,"containsRect:r");return this.I<=a.x&&a.x+a.width<=this.I+this.fa&&this.J<=a.y&&a.y+a.height<=this.J+this.ea};
t.contains=function(a,b,c,d){G?(E(a,M,"contains:x"),E(b,M,"contains:y"),void 0===c?c=0:E(c,M,"contains:w"),void 0===d?d=0:E(d,M,"contains:h"),(0>c||0>d)&&v("Rect.contains:Width and height cannot be negative")):(void 0===c&&(c=0),void 0===d&&(d=0));return this.I<=a&&a+c<=this.I+this.fa&&this.J<=b&&b+d<=this.J+this.ea};t.offset=function(a,b){G&&(E(a,M,"offset:dx"),E(b,M,"offset:dy"),this.ha());this.I+=a;this.J+=b;return this};
t.Qc=function(a,b){G&&(E(a,M,"inflate:w"),E(b,M,"inflate:h"));return ec(this,b,a,b,a)};t.Yp=function(a){G&&w(a,fc,M,"addMargin:m");return ec(this,a.top,a.right,a.bottom,a.left)};t.aw=function(a){G&&w(a,fc,M,"subtractMargin:m");return ec(this,-a.top,-a.right,-a.bottom,-a.left)};t.xA=function(a,b,c,d){G&&(E(a,M,"grow:t"),E(b,M,"grow:r"),E(c,M,"grow:b"),E(d,M,"grow:l"));return ec(this,a,b,c,d)};
function ec(a,b,c,d,e){G&&a.ha();var f=a.fa;c+e<=-f?(a.I+=f/2,a.fa=0):(a.I-=e,a.fa+=c+e);c=a.ea;b+d<=-c?(a.J+=c/2,a.ea=0):(a.J-=b,a.ea+=b+d);return a}t.sy=function(a){G&&w(a,M,M,"intersectRect:r");return gc(this,a.x,a.y,a.width,a.height)};t.ov=function(a,b,c,d){G&&(E(a,M,"intersect:x"),E(b,M,"intersect:y"),E(c,M,"intersect:w"),E(d,M,"intersect:h"),(0>c||0>d)&&v("Rect.intersect:Width and height cannot be negative"));return gc(this,a,b,c,d)};
function gc(a,b,c,d,e){G&&a.ha();var f=Math.max(a.I,b),g=Math.max(a.J,c);b=Math.min(a.I+a.fa,b+d);c=Math.min(a.J+a.ea,c+e);a.I=f;a.J=g;a.fa=Math.max(0,b-f);a.ea=Math.max(0,c-g);return a}t.Sc=function(a){G&&w(a,M,M,"intersectsRect:r");return this.pv(a.x,a.y,a.width,a.height)};
t.pv=function(a,b,c,d){G&&(E(a,M,"intersects:x"),E(b,M,"intersects:y"),E(a,M,"intersects:w"),E(b,M,"intersects:h"),(0>c||0>d)&&v("Rect.intersects:Width and height cannot be negative"));var e=this.fa,f=this.I;if(Infinity!==e&&Infinity!==c&&(e+=f,c+=a,isNaN(c)||isNaN(e)||f>c||a>e))return!1;a=this.ea;c=this.J;return Infinity!==a&&Infinity!==d&&(a+=c,d+=b,isNaN(d)||isNaN(a)||c>d||b>a)?!1:!0};
function hc(a,b){var c=a.fa,d=a.I,e=b.x-10;if(d>b.width+10+10+e||e>c+d)return!1;c=a.ea;a=a.J;d=b.y-10;return a>b.height+10+10+d||d>c+a?!1:!0}t.af=function(a){G&&w(a,K,M,"unionPoint:p");return ic(this,a.x,a.y,0,0)};t.Xc=function(a){G&&w(a,M,M,"unionRect:r");return ic(this,a.I,a.J,a.fa,a.ea)};
t.gw=function(a,b,c,d){G?(E(a,M,"union:x"),E(b,M,"union:y"),void 0===c?c=0:E(c,M,"union:w"),void 0===d?d=0:E(d,M,"union:h"),(0>c||0>d)&&v("Rect.union:Width and height cannot be negative"),this.ha()):(void 0===c&&(c=0),void 0===d&&(d=0));return ic(this,a,b,c,d)};function ic(a,b,c,d,e){var f=Math.min(a.I,b),g=Math.min(a.J,c);b=Math.max(a.I+a.fa,b+d);c=Math.max(a.J+a.ea,c+e);a.I=f;a.J=g;a.fa=b-f;a.ea=c-g;return a}
t.fj=function(a,b,c){G&&(E(a,M,"setSpot:x"),E(b,M,"setSpot:y"),w(c,Ib,M,"setSpot:spot"),this.ha());this.I=a-c.offsetX-c.x*this.fa;this.J=b-c.offsetY-c.y*this.ea;return this};
function jc(a,b,c,d,e,f,g,h){G?(E(a,M,"contains:rx"),E(b,M,"contains:ry"),E(c,M,"contains:rw"),E(d,M,"contains:rh"),E(e,M,"contains:x"),E(f,M,"contains:y"),void 0===g?g=0:E(g,M,"contains:w"),void 0===h?h=0:E(h,M,"contains:h"),(0>c||0>d||0>g||0>h)&&v("Rect.contains:Width and height cannot be negative")):(void 0===g&&(g=0),void 0===h&&(h=0));return a<=e&&e+g<=a+c&&b<=f&&f+h<=b+d}
function nc(a,b,c,d,e,f,g,h){G&&(E(a,M,"intersects:rx"),E(b,M,"intersects:ry"),E(c,M,"intersects:rw"),E(d,M,"intersects:rh"),E(e,M,"intersects:x"),E(f,M,"intersects:y"),E(g,M,"intersects:w"),E(h,M,"intersects:h"),(0>c||0>d||0>g||0>h)&&v("Rect.intersects:Width and height cannot be negative"));return a>g+e||e>c+a?!1:b>h+f||f>d+b?!1:!0}t.s=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)};t.DA=function(){return 0===this.width&&0===this.height};
M.alloc=function(){var a=oc.pop();return void 0===a?new M:a};M.allocAt=function(a,b,c,d){var e=oc.pop();return void 0===e?new M(a,b,c,d):e.h(a,b,c,d)};M.free=function(a){oc.push(a)};
na.Object.defineProperties(M.prototype,{x:{configurable:!0,get:function(){return this.I},set:function(a){G&&(A(a,"number",M,"x"),this.ha(a));this.I=a}},y:{configurable:!0,get:function(){return this.J},set:function(a){G&&(A(a,"number",M,"y"),this.ha(a));this.J=a}},width:{configurable:!0,get:function(){return this.fa},set:function(a){G&&(A(a,"number",M,"width"),this.ha(a));0>a&&Ba(a,">= 0",M,"width");this.fa=a}},height:{configurable:!0,get:function(){return this.ea},
set:function(a){G&&(A(a,"number",M,"height"),this.ha(a));0>a&&Ba(a,">= 0",M,"height");this.ea=a}},left:{configurable:!0,get:function(){return this.I},set:function(a){G&&(A(a,"number",M,"left"),this.ha(a));this.I=a}},top:{configurable:!0,get:function(){return this.J},set:function(a){G&&(A(a,"number",M,"top"),this.ha(a));this.J=a}},right:{configurable:!0,get:function(){return this.I+this.fa},set:function(a){G&&(E(a,M,"right"),this.ha(a));this.I+=a-(this.I+this.fa)}},
bottom:{configurable:!0,get:function(){return this.J+this.ea},set:function(a){G&&(E(a,M,"top"),this.ha(a));this.J+=a-(this.J+this.ea)}},position:{configurable:!0,get:function(){return new K(this.I,this.J)},set:function(a){G&&(w(a,K,M,"position"),this.ha(a));this.I=a.x;this.J=a.y}},size:{configurable:!0,get:function(){return new Hb(this.fa,this.ea)},set:function(a){G&&(w(a,Hb,M,"size"),this.ha(a));this.fa=a.width;this.ea=a.height}},center:{configurable:!0,
enumerable:!0,get:function(){return new K(this.I+this.fa/2,this.J+this.ea/2)},set:function(a){G&&(w(a,K,M,"center"),this.ha(a));this.I=a.x-this.fa/2;this.J=a.y-this.ea/2}},centerX:{configurable:!0,get:function(){return this.I+this.fa/2},set:function(a){G&&(E(a,M,"centerX"),this.ha(a));this.I=a-this.fa/2}},centerY:{configurable:!0,get:function(){return this.J+this.ea/2},set:function(a){G&&(E(a,M,"centerY"),this.ha(a));this.J=a-this.ea/2}}});M.prototype.isEmpty=M.prototype.DA;
M.prototype.isReal=M.prototype.s;M.intersectsLineSegment=function(a,b,c,d,e,f,g,h){G&&(E(a,M,"intersectsLineSegment:x"),E(b,M,"intersectsLineSegment:y"),E(c,M,"intersectsLineSegment:w"),E(d,M,"intersectsLineSegment:h"),E(e,M,"intersectsLineSegment:p1x"),E(f,M,"intersectsLineSegment:p1y"),E(g,M,"intersectsLineSegment:p2x"),E(h,M,"intersectsLineSegment:p2y"),(0>c||0>d)&&v("Rect.intersectsLineSegment: width and height cannot be negative"));return L.ty(a,b,c,d,e,f,g,h)};M.prototype.setSpot=M.prototype.fj;
M.prototype.union=M.prototype.gw;M.prototype.unionRect=M.prototype.Xc;M.prototype.unionPoint=M.prototype.af;M.prototype.intersects=M.prototype.pv;M.prototype.intersectsRect=M.prototype.Sc;M.prototype.intersect=M.prototype.ov;M.prototype.intersectRect=M.prototype.sy;M.prototype.grow=M.prototype.xA;M.prototype.subtractMargin=M.prototype.aw;M.prototype.addMargin=M.prototype.Yp;M.prototype.inflate=M.prototype.Qc;M.prototype.offset=M.prototype.offset;M.prototype.contains=M.prototype.contains;
M.prototype.containsRect=M.prototype.Te;M.prototype.containsPoint=M.prototype.ca;M.prototype.equalsApprox=M.prototype.Za;M.prototype.equalTo=M.prototype.Qi;M.prototype.equals=M.prototype.B;M.prototype.setSize=M.prototype.hB;M.prototype.setPoint=M.prototype.Wc;M.prototype.set=M.prototype.set;M.prototype.setTo=M.prototype.Eg;var pc=null,tc=null,oc=[];M.className="Rect";M.parse=bc;M.stringify=cc;M.contains=jc;M.intersects=nc;M.ZeroRect=pc=(new M(0,0,0,0)).ia();M.NoRect=tc=(new M(NaN,NaN,NaN,NaN)).ia();
M.parse=bc;M.stringify=cc;M.contains=jc;M.intersects=nc;function fc(a,b,c,d){void 0===a?this.Ge=this.ve=this.Pe=this.Re=0:void 0===b?this.left=this.bottom=this.right=this.top=a:void 0===c?(this.top=a,this.right=b,this.bottom=a,this.left=b):void 0!==d?(this.top=a,this.right=b,this.bottom=c,this.left=d):v("Invalid arguments to Margin constructor: "+a+", "+b+", "+c+", "+d);this.u=!1}fc.prototype.assign=function(a){this.Re=a.Re;this.Pe=a.Pe;this.ve=a.ve;this.Ge=a.Ge;return this};
fc.prototype.Eg=function(a,b,c,d){G&&(A(a,"number",fc,"setTo:t"),A(b,"number",fc,"setTo:r"),A(c,"number",fc,"setTo:b"),A(d,"number",fc,"setTo:l"),this.ha());this.Re=a;this.Pe=b;this.ve=c;this.Ge=d;return this};fc.prototype.set=function(a){G&&(w(a,fc,fc,"assign:m"),this.ha());this.Re=a.Re;this.Pe=a.Pe;this.ve=a.ve;this.Ge=a.Ge;return this};fc.prototype.copy=function(){var a=new fc;a.Re=this.Re;a.Pe=this.Pe;a.ve=this.ve;a.Ge=this.Ge;return a};t=fc.prototype;
t.ia=function(){this.u=!0;Object.freeze(this);return this};t.L=function(){return this.u||Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.u=!0;return this};t.ka=function(){Object.isFrozen(this)&&v("cannot thaw constant: "+this);this.u=!1;return this};t.ha=function(a){if(G&&this.u){var b="The Margin is frozen, so its properties cannot be set: "+this.toString();void 0!==a&&(b+="  to value: "+a);v(b)}};
function uc(a){if("string"===typeof a){a=a.split(" ");for(var b=0,c=NaN;""===a[b];)b++;var d=a[b++];d&&(c=parseFloat(d));if(isNaN(c))return new fc;for(var e=NaN;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));if(isNaN(e))return new fc(c);for(var f=NaN;""===a[b];)b++;(d=a[b++])&&(f=parseFloat(d));if(isNaN(f))return new fc(c,e);for(var g=NaN;""===a[b];)b++;(d=a[b++])&&(g=parseFloat(d));return isNaN(g)?new fc(c,e):new fc(c,e,f,g)}return new fc}
function vc(a){G&&w(a,fc);return a.top.toString()+" "+a.right.toString()+" "+a.bottom.toString()+" "+a.left.toString()}t.toString=function(){return"Margin("+this.top+","+this.right+","+this.bottom+","+this.left+")"};t.B=function(a){return a instanceof fc?this.Re===a.top&&this.Pe===a.right&&this.ve===a.bottom&&this.Ge===a.left:!1};t.Qi=function(a,b,c,d){return this.Re===a&&this.Pe===b&&this.ve===c&&this.Ge===d};
t.Za=function(a){return L.A(this.Re,a.top)&&L.A(this.Pe,a.right)&&L.A(this.ve,a.bottom)&&L.A(this.Ge,a.left)};t.s=function(){return isFinite(this.top)&&isFinite(this.right)&&isFinite(this.bottom)&&isFinite(this.left)};fc.alloc=function(){var a=wc.pop();return void 0===a?new fc:a};fc.free=function(a){wc.push(a)};
na.Object.defineProperties(fc.prototype,{top:{configurable:!0,get:function(){return this.Re},set:function(a){G&&(E(a,fc,"top"),this.ha(a));this.Re=a}},right:{configurable:!0,get:function(){return this.Pe},set:function(a){G&&(E(a,fc,"right"),this.ha(a));this.Pe=a}},bottom:{configurable:!0,get:function(){return this.ve},set:function(a){G&&(E(a,fc,"bottom"),this.ha(a));this.ve=a}},left:{configurable:!0,get:function(){return this.Ge},set:function(a){G&&
(E(a,fc,"left"),this.ha(a));this.Ge=a}}});fc.prototype.isReal=fc.prototype.s;fc.prototype.equalsApprox=fc.prototype.Za;fc.prototype.equalTo=fc.prototype.Qi;fc.prototype.equals=fc.prototype.B;fc.prototype.set=fc.prototype.set;fc.prototype.setTo=fc.prototype.Eg;var zc=null,Ac=null,wc=[];fc.className="Margin";fc.parse=uc;fc.stringify=vc;fc.ZeroMargin=zc=(new fc(0,0,0,0)).ia();fc.TwoMargin=Ac=(new fc(2,2,2,2)).ia();fc.parse=uc;fc.stringify=vc;
function Ib(a,b,c,d){void 0===a?this.ke=this.je=this.J=this.I=0:(void 0===b&&(b=0),void 0===c&&(c=0),void 0===d&&(d=0),this.x=a,this.y=b,this.offsetX=c,this.offsetY=d);this.u=!1}var Bc,Cc,Dc,Gc,Hc,Ic,Jc,Kc,Lc,Nc,Oc,Pc,Qc,Rc,Sc,Tc,Uc,Vc,Wc,Xc,Zc,$c,ad,bd,cd,dd,ed,fd,id,jd,kd,ld,md,nd,od,pd;Ib.prototype.assign=function(a){this.I=a.I;this.J=a.J;this.je=a.je;this.ke=a.ke;return this};
Ib.prototype.Eg=function(a,b,c,d){G&&(qd(a,"setTo:x"),qd(b,"setTo:y"),rd(c,"setTo:offx"),rd(d,"setTo:offy"),this.ha());this.I=a;this.J=b;this.je=c;this.ke=d;return this};Ib.prototype.set=function(a){G&&(w(a,Ib,Ib,"set:s"),this.ha());this.I=a.I;this.J=a.J;this.je=a.je;this.ke=a.ke;return this};Ib.prototype.copy=function(){var a=new Ib;a.I=this.I;a.J=this.J;a.je=this.je;a.ke=this.ke;return a};t=Ib.prototype;t.ia=function(){this.u=!0;Object.freeze(this);return this};
t.L=function(){return this.u||Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.u=!0;return this};t.ka=function(){Object.isFrozen(this)&&v("cannot thaw constant: "+this);this.u=!1;return this};t.ha=function(a){if(G&&this.u){var b="The Spot is frozen, so its properties cannot be set: "+this.toString();void 0!==a&&(b+="  to value: "+a);v(b)}};function sd(a,b){a.I=NaN;a.J=NaN;a.je=b;return a}function qd(a,b){(isNaN(a)||1<a||0>a)&&Ba(a,"0 <= "+b+" <= 1",Ib,b)}
function rd(a,b){(isNaN(a)||Infinity===a||-Infinity===a)&&Ba(a,"real number, not NaN or Infinity",Ib,b)}
function td(a){if("string"===typeof a){a=a.trim();if("None"===a)return Bc;if("TopLeft"===a)return Cc;if("Top"===a||"TopCenter"===a||"MiddleTop"===a)return Dc;if("TopRight"===a)return Gc;if("Left"===a||"LeftCenter"===a||"MiddleLeft"===a)return Hc;if("Center"===a)return Ic;if("Right"===a||"RightCenter"===a||"MiddleRight"===a)return Jc;if("BottomLeft"===a)return Kc;if("Bottom"===a||"BottomCenter"===a||"MiddleBottom"===a)return Lc;if("BottomRight"===a)return Nc;if("TopSide"===a)return Oc;if("LeftSide"===
a)return Pc;if("RightSide"===a)return Qc;if("BottomSide"===a)return Rc;if("TopBottomSides"===a)return Sc;if("LeftRightSides"===a)return Tc;if("TopLeftSides"===a)return Uc;if("TopRightSides"===a)return Vc;if("BottomLeftSides"===a)return Wc;if("BottomRightSides"===a)return Xc;if("NotTopSide"===a)return Zc;if("NotLeftSide"===a)return $c;if("NotRightSide"===a)return ad;if("NotBottomSide"===a)return bd;if("AllSides"===a)return cd;if("Default"===a)return dd;a=a.split(" ");for(var b=0,c=0;""===a[b];)b++;
var d=a[b++];void 0!==d&&0<d.length&&(c=parseFloat(d));for(var e=0;""===a[b];)b++;d=a[b++];void 0!==d&&0<d.length&&(e=parseFloat(d));for(var f=0;""===a[b];)b++;d=a[b++];void 0!==d&&0<d.length&&(f=parseFloat(d));for(var g=0;""===a[b];)b++;d=a[b++];void 0!==d&&0<d.length&&(g=parseFloat(d));return new Ib(c,e,f,g)}return new Ib}function ud(a){G&&w(a,Ib);return a.fb()?a.x.toString()+" "+a.y.toString()+" "+a.offsetX.toString()+" "+a.offsetY.toString():a.toString()}
t.toString=function(){return this.fb()?0===this.je&&0===this.ke?"Spot("+this.x+","+this.y+")":"Spot("+this.x+","+this.y+","+this.offsetX+","+this.offsetY+")":this.B(Bc)?"None":this.B(Cc)?"TopLeft":this.B(Dc)?"Top":this.B(Gc)?"TopRight":this.B(Hc)?"Left":this.B(Ic)?"Center":this.B(Jc)?"Right":this.B(Kc)?"BottomLeft":this.B(Lc)?"Bottom":this.B(Nc)?"BottomRight":this.B(Oc)?"TopSide":this.B(Pc)?"LeftSide":this.B(Qc)?"RightSide":this.B(Rc)?"BottomSide":this.B(Sc)?"TopBottomSides":this.B(Tc)?"LeftRightSides":
this.B(Uc)?"TopLeftSides":this.B(Vc)?"TopRightSides":this.B(Wc)?"BottomLeftSides":this.B(Xc)?"BottomRightSides":this.B(Zc)?"NotTopSide":this.B($c)?"NotLeftSide":this.B(ad)?"NotRightSide":this.B(bd)?"NotBottomSide":this.B(cd)?"AllSides":this.B(dd)?"Default":"None"};t.B=function(a){return a instanceof Ib?(this.I===a.x||isNaN(this.I)&&isNaN(a.x))&&(this.J===a.y||isNaN(this.J)&&isNaN(a.y))&&this.je===a.offsetX&&this.ke===a.offsetY:!1};
t.Dv=function(){return new Ib(.5-(this.I-.5),.5-(this.J-.5),-this.je,-this.ke)};t.Pf=function(a){if(!this.Uc())return!1;if(!a.Uc())if(a.B(ed))a=Pc;else if(a.B(fd))a=Qc;else if(a.B(id))a=Oc;else if(a.B(jd))a=Rc;else return!1;a=a.offsetY;return(this.ke&a)===a};t.fb=function(){return!isNaN(this.x)&&!isNaN(this.y)};t.ec=function(){return isNaN(this.x)||isNaN(this.y)};t.Uc=function(){return isNaN(this.x)&&isNaN(this.y)&&1===this.offsetX&&0!==this.offsetY};
t.sq=function(){return isNaN(this.x)&&isNaN(this.y)&&0===this.offsetX&&0===this.offsetY};t.Kb=function(){return isNaN(this.x)&&isNaN(this.y)&&-1===this.offsetX&&0===this.offsetY};Ib.alloc=function(){var a=vd.pop();return void 0===a?new Ib:a};Ib.free=function(a){vd.push(a)};
na.Object.defineProperties(Ib.prototype,{x:{configurable:!0,get:function(){return this.I},set:function(a){G&&(qd(a,"x"),this.ha(a));this.I=a}},y:{configurable:!0,get:function(){return this.J},set:function(a){G&&(qd(a,"y"),this.ha(a));this.J=a}},offsetX:{configurable:!0,get:function(){return this.je},set:function(a){G&&(rd(a,"offsetX"),this.ha(a));this.je=a}},offsetY:{configurable:!0,get:function(){return this.ke},set:function(a){G&&(rd(a,"offsetY"),
this.ha(a));this.ke=a}}});Ib.prototype.isDefault=Ib.prototype.Kb;Ib.prototype.isNone=Ib.prototype.sq;Ib.prototype.isSide=Ib.prototype.Uc;Ib.prototype.isNoSpot=Ib.prototype.ec;Ib.prototype.isSpot=Ib.prototype.fb;Ib.prototype.includesSide=Ib.prototype.Pf;Ib.prototype.opposite=Ib.prototype.Dv;Ib.prototype.equals=Ib.prototype.B;Ib.prototype.set=Ib.prototype.set;Ib.prototype.setTo=Ib.prototype.Eg;var vd=[];Ib.className="Spot";Ib.parse=td;Ib.stringify=ud;Ib.None=Bc=sd(new Ib(0,0,0,0),0).ia();
Ib.Default=dd=sd(new Ib(0,0,-1,0),-1).ia();Ib.TopLeft=Cc=(new Ib(0,0,0,0)).ia();Ib.TopCenter=Dc=(new Ib(.5,0,0,0)).ia();Ib.TopRight=Gc=(new Ib(1,0,0,0)).ia();Ib.LeftCenter=Hc=(new Ib(0,.5,0,0)).ia();Ib.Center=Ic=(new Ib(.5,.5,0,0)).ia();Ib.RightCenter=Jc=(new Ib(1,.5,0,0)).ia();Ib.BottomLeft=Kc=(new Ib(0,1,0,0)).ia();Ib.BottomCenter=Lc=(new Ib(.5,1,0,0)).ia();Ib.BottomRight=Nc=(new Ib(1,1,0,0)).ia();Ib.MiddleTop=kd=Dc;Ib.MiddleLeft=ld=Hc;Ib.MiddleRight=md=Jc;Ib.MiddleBottom=nd=Lc;Ib.Top=id=Dc;
Ib.Left=ed=Hc;Ib.Right=fd=Jc;Ib.Bottom=jd=Lc;Ib.TopSide=Oc=sd(new Ib(0,0,1,1),1).ia();Ib.LeftSide=Pc=sd(new Ib(0,0,1,2),1).ia();Ib.RightSide=Qc=sd(new Ib(0,0,1,4),1).ia();Ib.BottomSide=Rc=sd(new Ib(0,0,1,8),1).ia();Ib.TopBottomSides=Sc=sd(new Ib(0,0,1,9),1).ia();Ib.LeftRightSides=Tc=sd(new Ib(0,0,1,6),1).ia();Ib.TopLeftSides=Uc=sd(new Ib(0,0,1,3),1).ia();Ib.TopRightSides=Vc=sd(new Ib(0,0,1,5),1).ia();Ib.BottomLeftSides=Wc=sd(new Ib(0,0,1,10),1).ia();Ib.BottomRightSides=Xc=sd(new Ib(0,0,1,12),1).ia();
Ib.NotTopSide=Zc=sd(new Ib(0,0,1,14),1).ia();Ib.NotLeftSide=$c=sd(new Ib(0,0,1,13),1).ia();Ib.NotRightSide=ad=sd(new Ib(0,0,1,11),1).ia();Ib.NotBottomSide=bd=sd(new Ib(0,0,1,7),1).ia();Ib.AllSides=cd=sd(new Ib(0,0,1,15),1).ia();od=(new Ib(.156,.156)).ia();pd=(new Ib(.844,.844)).ia();Ib.parse=td;Ib.stringify=ud;function Jb(){this.m11=1;this.m21=this.m12=0;this.m22=1;this.dy=this.dx=0}
Jb.prototype.set=function(a){this.m11=a.m11;this.m12=a.m12;this.m21=a.m21;this.m22=a.m22;this.dx=a.dx;this.dy=a.dy;return this};Jb.prototype.setTransform=function(a,b,c,d,e,f){this.m11=a;this.m12=b;this.m21=c;this.m22=d;this.dx=e;this.dy=f;return this};Jb.prototype.copy=function(){var a=new Jb;a.m11=this.m11;a.m12=this.m12;a.m21=this.m21;a.m22=this.m22;a.dx=this.dx;a.dy=this.dy;return a};
Jb.prototype.toString=function(){return"Transform("+this.m11+","+this.m12+","+this.m21+","+this.m22+","+this.dx+","+this.dy+")"};Jb.prototype.B=function(a){return this.m11===a.m11&&this.m12===a.m12&&this.m21===a.m21&&this.m22===a.m22&&this.dx===a.dx&&this.dy===a.dy};Jb.prototype.Ps=function(){return 0===this.dx&&0===this.dy&&1===this.m11&&0===this.m12&&0===this.m21&&1===this.m22};Jb.prototype.reset=function(){this.m11=1;this.m21=this.m12=0;this.m22=1;this.dy=this.dx=0;return this};
Jb.prototype.multiply=function(a){var b=this.m11*a.m11+this.m21*a.m12,c=this.m12*a.m11+this.m22*a.m12,d=this.m11*a.m21+this.m21*a.m22,e=this.m12*a.m21+this.m22*a.m22;this.dx=this.m11*a.dx+this.m21*a.dy+this.dx;this.dy=this.m12*a.dx+this.m22*a.dy+this.dy;this.m11=b;this.m12=c;this.m21=d;this.m22=e;return this};
Jb.prototype.zv=function(a){var b=1/(a.m11*a.m22-a.m12*a.m21),c=a.m22*b,d=-a.m12*b,e=-a.m21*b,f=a.m11*b,g=b*(a.m21*a.dy-a.m22*a.dx);a=b*(a.m12*a.dx-a.m11*a.dy);b=this.m11*c+this.m21*d;c=this.m12*c+this.m22*d;d=this.m11*e+this.m21*f;e=this.m12*e+this.m22*f;this.dx=this.m11*g+this.m21*a+this.dx;this.dy=this.m12*g+this.m22*a+this.dy;this.m11=b;this.m12=c;this.m21=d;this.m22=e;return this};
Jb.prototype.Ns=function(){var a=1/(this.m11*this.m22-this.m12*this.m21),b=-this.m12*a,c=-this.m21*a,d=this.m11*a,e=a*(this.m21*this.dy-this.m22*this.dx),f=a*(this.m12*this.dx-this.m11*this.dy);this.m11=this.m22*a;this.m12=b;this.m21=c;this.m22=d;this.dx=e;this.dy=f;return this};
Jb.prototype.rotate=function(a,b,c){360<=a?a-=360:0>a&&(a+=360);if(0===a)return this;this.translate(b,c);if(90===a){a=0;var d=1}else 180===a?(a=-1,d=0):270===a?(a=0,d=-1):(d=a*Math.PI/180,a=Math.cos(d),d=Math.sin(d));var e=this.m12*a+this.m22*d,f=this.m11*-d+this.m21*a,g=this.m12*-d+this.m22*a;this.m11=this.m11*a+this.m21*d;this.m12=e;this.m21=f;this.m22=g;this.translate(-b,-c);return this};t=Jb.prototype;t.translate=function(a,b){this.dx+=this.m11*a+this.m21*b;this.dy+=this.m12*a+this.m22*b;return this};
t.scale=function(a,b){void 0===b&&(b=a);this.m11*=a;this.m12*=a;this.m21*=b;this.m22*=b;return this};t.Ga=function(a){var b=a.x,c=a.y;return a.h(b*this.m11+c*this.m21+this.dx,b*this.m12+c*this.m22+this.dy)};t.Od=function(a){var b=1/(this.m11*this.m22-this.m12*this.m21),c=a.x,d=a.y;return a.h(c*this.m22*b+d*-this.m21*b+b*(this.m21*this.dy-this.m22*this.dx),c*-this.m12*b+d*this.m11*b+b*(this.m12*this.dx-this.m11*this.dy))};
t.Nx=function(a){var b=1/(this.m11*this.m22-this.m12*this.m21),c=1.25*a.x,d=1.2*a.y;return a.h(c*this.m22*b+d*-this.m21*b+b*(this.m21*this.dy-this.m22*this.dx),c*-this.m12*b+d*this.m11*b+b*(this.m12*this.dx-this.m11*this.dy))};
t.Kq=function(a){var b=a.x,c=a.y,d=b+a.width,e=c+a.height,f=this.m11,g=this.m12,h=this.m21,k=this.m22,l=this.dx,m=this.dy,n=b*f+c*h+l,p=b*g+c*k+m,r=d*f+c*h+l,q=d*g+c*k+m;c=b*f+e*h+l;b=b*g+e*k+m;f=d*f+e*h+l;d=d*g+e*k+m;e=Math.min(n,r);n=Math.max(n,r);r=Math.min(p,q);p=Math.max(p,q);e=Math.min(e,c);n=Math.max(n,c);r=Math.min(r,b);p=Math.max(p,b);e=Math.min(e,f);n=Math.max(n,f);r=Math.min(r,d);p=Math.max(p,d);a.h(e,r,n-e,p-r);return a};Jb.alloc=function(){var a=wd.pop();return void 0===a?new Jb:a};
Jb.free=function(a){wd.push(a)};Jb.prototype.transformRect=Jb.prototype.Kq;Jb.prototype.transformPoint=Jb.prototype.Ga;Jb.prototype.scale=Jb.prototype.scale;Jb.prototype.translate=Jb.prototype.translate;Jb.prototype.rotate=Jb.prototype.rotate;Jb.prototype.invert=Jb.prototype.Ns;Jb.prototype.multiplyInverted=Jb.prototype.zv;Jb.prototype.multiply=Jb.prototype.multiply;Jb.prototype.reset=Jb.prototype.reset;Jb.prototype.isIdentity=Jb.prototype.Ps;Jb.prototype.equals=Jb.prototype.B;
Jb.prototype.setTransform=Jb.prototype.setTransform;Jb.prototype.set=Jb.prototype.set;var wd=[];Jb.className="Transform";Jb.xF="54a702f3e53909c447824c6706603faf4c";
var L={rB:"7da71ca0ad381e90",Hg:(Math.sqrt(2)-1)/3*4,Fw:null,sqrt:function(a){if(0>=a)return 0;var b=L.Fw;if(null===b){b=[];for(var c=0;2E3>=c;c++)b[c]=Math.sqrt(c);L.Fw=b}return 1>a?(c=1/a,2E3>=c?1/b[c|0]:Math.sqrt(a)):2E3>=a?b[a|0]:Math.sqrt(a)},A:function(a,b){a-=b;return.5>a&&-.5<a},da:function(a,b){a-=b;return 5E-8>a&&-5E-8<a},Sb:function(a,b,c,d,e,f,g){0>=e&&(e=1E-6);if(a<c){var h=a;var k=c}else h=c,k=a;if(b<d){var l=b;var m=d}else l=d,m=b;if(a===c)return l<=g&&g<=m&&a-e<=f&&f<=a+e;if(b===d)return h<=
f&&f<=k&&b-e<=g&&g<=b+e;k+=e;h-=e;if(h<=f&&f<=k&&(m+=e,l-=e,l<=g&&g<=m))if(k-h>m-l)if(a-c>e||c-a>e){if(f=(d-b)/(c-a)*(f-a)+b,f-e<=g&&g<=f+e)return!0}else return!0;else if(b-d>e||d-b>e){if(g=(c-a)/(d-b)*(g-b)+a,g-e<=f&&f<=g+e)return!0}else return!0;return!1},vs:function(a,b,c,d,e,f,g,h,k,l,m,n){if(L.Sb(a,b,g,h,n,c,d)&&L.Sb(a,b,g,h,n,e,f))return L.Sb(a,b,g,h,n,l,m);var p=(a+c)/2,r=(b+d)/2,q=(c+e)/2,u=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(p+q)/2;c=(r+u)/2;q=(q+e)/2;u=(u+f)/2;var x=(d+q)/2,y=(c+u)/2;return L.vs(a,
b,p,r,d,c,x,y,k,l,m,n)||L.vs(x,y,q,u,e,f,g,h,k,l,m,n)},Az:function(a,b,c,d,e,f,g,h,k){var l=(c+e)/2,m=(d+f)/2;k.h((((a+c)/2+l)/2+(l+(e+g)/2)/2)/2,(((b+d)/2+m)/2+(m+(f+h)/2)/2)/2);return k},zz:function(a,b,c,d,e,f,g,h){var k=(c+e)/2,l=(d+f)/2;return Nb(((a+c)/2+k)/2,((b+d)/2+l)/2,(k+(e+g)/2)/2,(l+(f+h)/2)/2)},fm:function(a,b,c,d,e,f,g,h,k,l){if(L.Sb(a,b,g,h,k,c,d)&&L.Sb(a,b,g,h,k,e,f))ic(l,a,b,0,0),ic(l,g,h,0,0);else{var m=(a+c)/2,n=(b+d)/2,p=(c+e)/2,r=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(m+p)/2;c=(n+r)/
2;p=(p+e)/2;r=(r+f)/2;var q=(d+p)/2,u=(c+r)/2;L.fm(a,b,m,n,d,c,q,u,k,l);L.fm(q,u,p,r,e,f,g,h,k,l)}return l},Se:function(a,b,c,d,e,f,g,h,k,l){if(L.Sb(a,b,g,h,k,c,d)&&L.Sb(a,b,g,h,k,e,f))0===l.length&&(l.push(a),l.push(b)),l.push(g),l.push(h);else{var m=(a+c)/2,n=(b+d)/2,p=(c+e)/2,r=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(m+p)/2;c=(n+r)/2;p=(p+e)/2;r=(r+f)/2;var q=(d+p)/2,u=(c+r)/2;L.Se(a,b,m,n,d,c,q,u,k,l);L.Se(q,u,p,r,e,f,g,h,k,l)}return l},Iv:function(a,b,c,d,e,f,g,h,k,l){if(L.Sb(a,b,e,f,l,c,d))return L.Sb(a,
b,e,f,l,h,k);var m=(a+c)/2,n=(b+d)/2;c=(c+e)/2;d=(d+f)/2;var p=(m+c)/2,r=(n+d)/2;return L.Iv(a,b,m,n,p,r,g,h,k,l)||L.Iv(p,r,c,d,e,f,g,h,k,l)},CB:function(a,b,c,d,e,f,g){g.h(((a+c)/2+(c+e)/2)/2,((b+d)/2+(d+f)/2)/2);return g},Hv:function(a,b,c,d,e,f,g,h){if(L.Sb(a,b,e,f,g,c,d))ic(h,a,b,0,0),ic(h,e,f,0,0);else{var k=(a+c)/2,l=(b+d)/2;c=(c+e)/2;d=(d+f)/2;var m=(k+c)/2,n=(l+d)/2;L.Hv(a,b,k,l,m,n,g,h);L.Hv(m,n,c,d,e,f,g,h)}return h},yq:function(a,b,c,d,e,f,g,h){if(L.Sb(a,b,e,f,g,c,d))0===h.length&&(h.push(a),
h.push(b)),h.push(e),h.push(f);else{var k=(a+c)/2,l=(b+d)/2;c=(c+e)/2;d=(d+f)/2;var m=(k+c)/2,n=(l+d)/2;L.yq(a,b,k,l,m,n,g,h);L.yq(m,n,c,d,e,f,g,h)}return h},$p:function(a,b,c,d,e,f,g,h,k,l,m,n,p,r){if(L.Sb(a,b,g,h,p,c,d)&&L.Sb(a,b,g,h,p,e,f)){if(!L.pm(a,b,g,h,k,l,m,n))return!1;p=(a-g)*(l-n)-(b-h)*(k-m);if(0===p)return!1;r.h(((a*h-b*g)*(k-m)-(a-g)*(k*n-l*m))/p,((a*h-b*g)*(l-n)-(b-h)*(k*n-l*m))/p);return!0}var q=(a+c)/2,u=(b+d)/2,x=(c+e)/2,y=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(q+x)/2;c=(u+y)/2;x=(x+e)/
2;y=(y+f)/2;var z=(d+x)/2,B=(c+y)/2,D=Infinity,C=!1,J=0,S=0;L.$p(a,b,q,u,d,c,z,B,k,l,m,n,p,r)&&(a=(r.x-k)*(r.x-k)+(r.y-l)*(r.y-l),a<D&&(D=a,C=!0,J=r.x,S=r.y));L.$p(z,B,x,y,e,f,g,h,k,l,m,n,p,r)&&(r.x-k)*(r.x-k)+(r.y-l)*(r.y-l)<D&&(C=!0,J=r.x,S=r.y);C&&(r.x=J,r.y=S);return C},aq:function(a,b,c,d,e,f,g,h,k,l,m,n,p){var r=0;if(L.Sb(a,b,g,h,p,c,d)&&L.Sb(a,b,g,h,p,e,f)){p=(a-g)*(l-n)-(b-h)*(k-m);if(0===p)return r;var q=((a*h-b*g)*(k-m)-(a-g)*(k*n-l*m))/p,u=((a*h-b*g)*(l-n)-(b-h)*(k*n-l*m))/p;if(q>=m)return r;
if((k>m?k-m:m-k)<(l>n?l-n:n-l)){if(b<h?(k=b,a=h):(k=h,a=b),u<k||u>a)return r}else if(a<g?(k=a,a=g):k=g,q<k||q>a)return r;0<p?r++:0>p&&r--}else{q=(a+c)/2;u=(b+d)/2;var x=(c+e)/2,y=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(q+x)/2;c=(u+y)/2;x=(x+e)/2;y=(y+f)/2;var z=(d+x)/2,B=(c+y)/2;r+=L.aq(a,b,q,u,d,c,z,B,k,l,m,n,p);r+=L.aq(z,B,x,y,e,f,g,h,k,l,m,n,p)}return r},Th:function(a,b,c,d,e,f,g){if(L.da(a,c)){b<d?(c=b,b=d):c=d;if(f<c)return g.h(a,c),!1;if(f>b)return g.h(a,b),!1;g.h(a,f);return!0}if(L.da(b,d)){a<c?(d=
a,a=c):d=c;if(e<d)return g.h(d,b),!1;if(e>a)return g.h(a,b),!1;g.h(e,b);return!0}e=((a-e)*(a-c)+(b-f)*(b-d))/((c-a)*(c-a)+(d-b)*(d-b));if(-5E-6>e)return g.h(a,b),!1;if(1.000005<e)return g.h(c,d),!1;g.h(a+e*(c-a),b+e*(d-b));return!0},Ye:function(a,b,c,d,e,f,g,h,k){if(L.A(a,c)&&L.A(b,d))return k.h(a,b),!1;if(L.da(e,g))return L.da(a,c)?(L.Th(a,b,c,d,e,f,k),!1):L.Th(a,b,c,d,e,(d-b)/(c-a)*(e-a)+b,k);h=(h-f)/(g-e);if(L.da(a,c)){c=h*(a-e)+f;b<d?(e=b,b=d):e=d;if(c<e)return k.h(a,e),!1;if(c>b)return k.h(a,
b),!1;k.h(a,c);return!0}g=(d-b)/(c-a);if(L.da(h,g))return L.Th(a,b,c,d,e,f,k),!1;e=(g*a-h*e+f-b)/(g-h);if(L.da(g,0)){a<c?(d=a,a=c):d=c;if(e<d)return k.h(d,b),!1;if(e>a)return k.h(a,b),!1;k.h(e,b);return!0}return L.Th(a,b,c,d,e,g*(e-a)+b,k)},AB:function(a,b,c,d,e){return L.Ye(c.x,c.y,d.x,d.y,a.x,a.y,b.x,b.y,e)},zB:function(a,b,c,d,e,f,g,h,k,l){function m(c,d){var e=(c-a)*(c-a)+(d-b)*(d-b);e<n&&(n=e,k.h(c,d))}var n=Infinity;m(k.x,k.y);var p=0,r=0,q=0,u=0;e<g?(p=e,r=g):(p=g,r=e);f<h?(q=e,u=g):(q=g,u=
e);p=(r-p)/2+l;l=(u-q)/2+l;e=(e+g)/2;f=(f+h)/2;if(0===p||0===l)return k;if(.5>(c>a?c-a:a-c)){p=1-(c-e)*(c-e)/(p*p);if(0>p)return k;p=Math.sqrt(p);d=-l*p+f;m(c,l*p+f);m(c,d)}else{c=(d-b)/(c-a);d=1/(p*p)+c*c/(l*l);h=2*c*(b-c*a)/(l*l)-2*c*f/(l*l)-2*e/(p*p);p=h*h-4*d*(2*c*a*f/(l*l)-2*b*f/(l*l)+f*f/(l*l)+e*e/(p*p)-1+(b-c*a)*(b-c*a)/(l*l));if(0>p)return k;p=Math.sqrt(p);l=(-h+p)/(2*d);m(l,c*l-c*a+b);p=(-h-p)/(2*d);m(p,c*p-c*a+b)}return k},Of:function(a,b,c,d,e,f,g,h,k){var l=1E21,m=a,n=b;if(L.Ye(a,b,a,
d,e,f,g,h,k)){var p=(k.x-e)*(k.x-e)+(k.y-f)*(k.y-f);p<l&&(l=p,m=k.x,n=k.y)}L.Ye(c,b,c,d,e,f,g,h,k)&&(p=(k.x-e)*(k.x-e)+(k.y-f)*(k.y-f),p<l&&(l=p,m=k.x,n=k.y));L.Ye(a,b,c,b,e,f,g,h,k)&&(b=(k.x-e)*(k.x-e)+(k.y-f)*(k.y-f),b<l&&(l=b,m=k.x,n=k.y));L.Ye(a,d,c,d,e,f,g,h,k)&&(a=(k.x-e)*(k.x-e)+(k.y-f)*(k.y-f),a<l&&(l=a,m=k.x,n=k.y));k.h(m,n);return 1E21>l},yB:function(a,b,c,d,e,f,g,h,k){c=a-c;g=e-g;0===c||0===g?0===c?(b=(f-h)/g,h=a,e=b*h+(f-b*e)):(f=(b-d)/c,h=e,e=f*h+(b-f*a)):(d=(b-d)/c,h=(f-h)/g,a=b-d*a,
h=(f-h*e-a)/(d-h),e=d*h+a);k.h(h,e);return k},Ls:function(a,b,c){return L.ty(a.x,a.y,a.width,a.height,b.x,b.y,c.x,c.y)},ty:function(a,b,c,d,e,f,g,h){var k=a+c,l=b+d;return e===g?(f<h?(g=f,f=h):g=h,a<=e&&e<=k&&g<=l&&f>=b):f===h?(e<g?(h=e,e=g):h=g,b<=f&&f<=l&&h<=k&&e>=a):jc(a,b,c,d,e,f)||jc(a,b,c,d,g,h)||L.pm(a,b,k,b,e,f,g,h)||L.pm(k,b,k,l,e,f,g,h)||L.pm(k,l,a,l,e,f,g,h)||L.pm(a,l,a,b,e,f,g,h)?!0:!1},pm:function(a,b,c,d,e,f,g,h){return 0>=L.im(a,b,c,d,e,f)*L.im(a,b,c,d,g,h)&&0>=L.im(e,f,g,h,a,b)*L.im(e,
f,g,h,c,d)},im:function(a,b,c,d,e,f){c-=a;d-=b;a=e-a;b=f-b;f=a*d-b*c;0===f&&(f=a*c+b*d,0<f&&(f=(a-c)*c+(b-d)*d,0>f&&(f=0)));return f},wq:function(a){0>a&&(a+=360);360<=a&&(a-=360);return a},Tx:function(a,b,c,d,e,f){var g=Math.PI;f||(d*=g/180,e*=g/180);var h=d>e?-1:1;f=[];var k=g/2,l=d;d=Math.min(2*g,Math.abs(e-d));if(1E-5>d)return k=l+h*Math.min(d,k),h=a+c*Math.cos(l),l=b+c*Math.sin(l),a+=c*Math.cos(k),b+=c*Math.sin(k),c=(h+a)/2,k=(l+b)/2,f.push([h,l,c,k,c,k,a,b]),f;for(;1E-5<d;)e=l+h*Math.min(d,
k),f.push(L.Jz(c,l,e,a,b)),d-=Math.abs(e-l),l=e;return f},Jz:function(a,b,c,d,e){var f=(c-b)/2,g=a*Math.cos(f),h=a*Math.sin(f),k=-h,l=g*g+k*k,m=l+g*g+k*h;l=4/3*(Math.sqrt(2*l*m)-m)/(g*h-k*g);h=g-l*k;g=k+l*g;k=-g;l=f+b;f=Math.cos(l);l=Math.sin(l);return[d+a*Math.cos(b),e+a*Math.sin(b),d+h*f-g*l,e+h*l+g*f,d+h*f-k*l,e+h*l+k*f,d+a*Math.cos(c),e+a*Math.sin(c)]},jq:function(a,b,c,d,e,f,g){c=Math.floor((a-c)/e)*e+c;d=Math.floor((b-d)/f)*f+d;var h=c;c+e-a<e/2&&(h=c+e);a=d;d+f-b<f/2&&(a=d+f);g.h(h,a);return g},
hy:function(a,b){var c=Math.max(a,b);a=Math.min(a,b);var d;do b=c%a,c=d=a,a=b;while(0<b);return d},Oz:function(a,b,c,d){var e=0>c,f=0>d;if(a<b){var g=1;var h=0}else g=0,h=1;var k=0===g?a:b;var l=0===g?c:d;if(0===g?e:f)l=-l;g=h;c=0===g?c:d;if(0===g?e:f)c=-c;return L.Pz(k,0===g?a:b,l,c,0,0)},Pz:function(a,b,c,d,e,f){if(0<d)if(0<c){e=a*a;f=b*b;a*=c;var g=b*d,h=-f+g,k=-f+Math.sqrt(a*a+g*g);b=h;for(var l=0;9999999999>l;++l){b=.5*(h+k);if(b===h||b===k)break;var m=a/(b+e),n=g/(b+f);m=m*m+n*n-1;if(0<m)h=
b;else if(0>m)k=b;else break}c=e*c/(b+e)-c;d=f*d/(b+f)-d;c=Math.sqrt(c*c+d*d)}else c=Math.abs(d-b);else d=a*a-b*b,f=a*c,f<d?(d=f/d,f=b*Math.sqrt(Math.abs(1-d*d)),c=a*d-c,c=Math.sqrt(c*c+f*f)):c=Math.abs(c-a);return c},se:new fb,Tm:new fb,Vf:new fb,Wf:0,Um:100};L.za=L.rB;
function N(a){G&&1<arguments.length&&v("Geometry constructor can take at most one optional argument, the Geometry type.");ab(this);this.u=!1;void 0===a?a=N.o:G&&db(a,N,N,"constructor:type");this.na=a;this.yc=this.oc=this.jd=this.hd=0;this.sj=new H;this.nr=this.sj.w;this.$q=(new M).freeze();this.wa=!0;this.an=this.Jk=null;this.bn=NaN;this.zf=Cc;this.Af=Nc;this.ml=this.nl=NaN;this.$f=Bd}
N.prototype.copy=function(){var a=new N;a.na=this.na;a.hd=this.hd;a.jd=this.jd;a.oc=this.oc;a.yc=this.yc;for(var b=this.sj.m,c=b.length,d=a.sj,e=0;e<c;e++){var f=b[e].copy();d.add(f)}a.nr=this.nr;a.$q.assign(this.$q);a.wa=this.wa;a.Jk=this.Jk;a.an=this.an;a.bn=this.bn;a.zf=this.zf.L();a.Af=this.Af.L();a.nl=this.nl;a.ml=this.ml;a.$f=this.$f;return a};N.prototype.ia=function(){this.freeze();Object.freeze(this);return this};
N.prototype.freeze=function(){this.u=!0;var a=this.figures;a.freeze();a=a.m;for(var b=a.length,c=0;c<b;c++)a[c].freeze();return this};N.prototype.ka=function(){Object.isFrozen(this)&&v("cannot thaw constant: "+this);this.u=!1;var a=this.figures;a.ka();a=a.m;for(var b=a.length,c=0;c<b;c++)a[c].ka();return this};
N.prototype.Za=function(a){if(!(a instanceof N))return!1;if(this.type!==a.type)return this.type===N.j&&a.type===N.o?Cd(this,a):a.type===N.j&&this.type===N.o?Cd(a,this):!1;if(this.type===N.o){var b=this.figures.m;a=a.figures.m;var c=b.length;if(c!==a.length)return!1;for(var d=0;d<c;d++)if(!b[d].Za(a[d]))return!1;return!0}return L.A(this.startX,a.startX)&&L.A(this.startY,a.startY)&&L.A(this.endX,a.endX)&&L.A(this.endY,a.endY)};
function Cd(a,b){return a.type!==N.j||b.type!==N.o?!1:1===b.figures.count&&(b=b.figures.M(0),1===b.segments.count&&L.A(a.startX,b.startX)&&L.A(a.startY,b.startY)&&(b=b.segments.M(0),b.type===Dd&&L.A(a.endX,b.endX)&&L.A(a.endY,b.endY)))?!0:!1}N.Da=function(a){return a.toString()};N.prototype.mb=function(a){a.classType===N?this.type=a:Ea(this,a)};
N.prototype.toString=function(a){void 0===a&&(a=-1);switch(this.type){case N.j:return 0>a?"M"+this.startX.toString()+" "+this.startY.toString()+"L"+this.endX.toString()+" "+this.endY.toString():"M"+this.startX.toFixed(a)+" "+this.startY.toFixed(a)+"L"+this.endX.toFixed(a)+" "+this.endY.toFixed(a);case N.F:var b=new M(this.startX,this.startY,0,0);b.gw(this.endX,this.endY,0,0);return 0>a?"M"+b.x.toString()+" "+b.y.toString()+"H"+b.right.toString()+"V"+b.bottom.toString()+"H"+b.left.toString()+"z":"M"+
b.x.toFixed(a)+" "+b.y.toFixed(a)+"H"+b.right.toFixed(a)+"V"+b.bottom.toFixed(a)+"H"+b.left.toFixed(a)+"z";case N.O:b=new M(this.startX,this.startY,0,0);b.gw(this.endX,this.endY,0,0);if(0>a)return a=b.left.toString()+" "+(b.y+b.height/2).toString(),"M"+a+"A"+(b.width/2).toString()+" "+(b.height/2).toString()+" 0 0 1 "+(b.right.toString()+" "+(b.y+b.height/2).toString())+"A"+(b.width/2).toString()+" "+(b.height/2).toString()+" 0 0 1 "+a;var c=b.left.toFixed(a)+" "+(b.y+b.height/2).toFixed(a);return"M"+
c+"A"+(b.width/2).toFixed(a)+" "+(b.height/2).toFixed(a)+" 0 0 1 "+(b.right.toFixed(a)+" "+(b.y+b.height/2).toFixed(a))+"A"+(b.width/2).toFixed(a)+" "+(b.height/2).toFixed(a)+" 0 0 1 "+c;case N.o:b="";c=this.figures.m;for(var d=c.length,e=0;e<d;e++){var f=c[e];0<e&&(b+=" x ");f.isFilled&&(b+="F ");b+=f.toString(a)}return b;default:return this.type.toString()}};
N.Ra=function(a){"string"!==typeof a&&za(a,"string",N,"fillPath:str");a=a.split(/[Xx]/);for(var b=a.length,c="",d=0;d<b;d++){var e=a[d];c=null!==e.match(/[Ff]/)?0===d?c+e:c+("X"+(" "===e[0]?"":" ")+e):c+((0===d?"":"X ")+"F"+(" "===e[0]?"":" ")+e)}return c};
N.parse=function(a,b){function c(){return u>=D-1?!0:null!==l[u+1].match(C)}function d(){u++;return l[u]}function e(a){var b=parseFloat(d()),c=parseFloat(d());x===x.toLowerCase()&&(b=B.x+b,c=B.y+c);a.h(b,c)}function f(){e(B);return B}function g(){e(z);return z}function h(){var a=y.toLowerCase();return"c"!==a&&"s"!==a&&"q"!==a&&"t"!==a?B:new K(2*B.x-z.x,2*B.y-z.y)}void 0===b&&(b=!1);"string"!==typeof a&&za(a,"string",N,"parse:str");var k=/([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])/gm;
a=a.replace(/,/gm," ");a=a.replace(k,"$1 $2");a=a.replace(k,"$1 $2");a=a.replace(/([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])([^s])/gm,"$1 $2");a=a.replace(/([^s])([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])/gm,"$1 $2");a=a.replace(/([0-9])([+\-])/gm,"$1 $2");a=a.replace(/[\s\r\t\n]+/gm," ");a=a.replace(/^\s+|\s+$/g,"");var l=a.split(" ");for(a=0;a<l.length;a++){var m=l[a];if(null!==m.match(/(\.[0-9]*)(\.)/gm)){k=Na();for(var n="",p=!1,r=0;r<m.length;r++){var q=m[r];"."!==q||p?"."===q?(k.push(n),n="."):n+=q:(p=!0,n+=q)}k.push(n);
l.splice(a,1);for(m=0;m<k.length;m++)l.splice(a+m,0,k[m]);a+=k.length-1;Pa(k)}}var u=-1,x="",y="";k=new K(0,0);var z=new K(0,0),B=new K(0,0),D=l.length;a=Ed(null);n=m=!1;p=!0;r=null;for(var C=/[UuBbMmZzLlHhVvCcSsQqTtAaFfXx]/;!(u>=D-1);)if(y=x,x=d(),""!==x)switch(x.toUpperCase()){case "X":p=!0;n=m=!1;break;case "M":r=f();null===a.pc||!0===p?(Fd(a,r.x,r.y,m,!n),p=!1):a.moveTo(r.x,r.y);for(k.assign(B);!c();)r=f(),a.lineTo(r.x,r.y);break;case "L":for(;!c();)r=f(),a.lineTo(r.x,r.y);break;case "H":for(;!c();)B=
new K((x===x.toLowerCase()?B.x:0)+parseFloat(d()),B.y),a.lineTo(B.x,B.y);break;case "V":for(;!c();)B=new K(B.x,(x===x.toLowerCase()?B.y:0)+parseFloat(d())),a.lineTo(B.x,B.y);break;case "C":for(;!c();){r=new K;e(r);q=g();var J=f();Gd(a,r.x,r.y,q.x,q.y,J.x,J.y)}break;case "S":for(;!c();)r=h(),q=g(),J=f(),Gd(a,r.x,r.y,q.x,q.y,J.x,J.y);break;case "Q":for(;!c();)r=g(),q=f(),Hd(a,r.x,r.y,q.x,q.y);break;case "T":for(;!c();)z=r=h(),q=f(),Hd(a,r.x,r.y,q.x,q.y);break;case "B":for(;!c();){r=parseFloat(d());
q=parseFloat(d());J=parseFloat(d());var S=parseFloat(d()),T=parseFloat(d()),aa=T,W=!1;c()||(aa=parseFloat(d()),c()||(W=0!==parseFloat(d())));x===x.toLowerCase()&&(J+=B.x,S+=B.y);a.arcTo(r,q,J,S,T,aa,W)}break;case "A":for(;!c();)r=Math.abs(parseFloat(d())),q=Math.abs(parseFloat(d())),J=parseFloat(d()),T=S=!1,W=aa=0,aa=d(),1===aa.length?(S=!!parseFloat(aa),T=!!parseFloat(d()),aa=parseFloat(d())):2===aa.length?(S=!!parseFloat(aa[0]),T=!!parseFloat(aa[1]),aa=parseFloat(d())):(S=!!parseFloat(aa[0]),T=
!!parseFloat(aa[1]),aa=parseFloat(aa.slice(2))),W=parseFloat(d()),x===x.toLowerCase()&&(aa=B.x+aa,W=B.y+W),B.h(aa,W),Id(a,r,q,J,S,T,aa,W);break;case "Z":Jd(a);B.assign(k);break;case "F":r="";for(q=1;l[u+q];)if(null!==l[u+q].match(/[Uu]/))q++;else if(null===l[u+q].match(C))q++;else{r=l[u+q];break}r.match(/[Mm]/)?m=!0:0<a.pc.segments.length&&(a.pc.isFilled=!0);break;case "U":r="";for(q=1;l[u+q];)if(null!==l[u+q].match(/[Ff]/))q++;else if(null===l[u+q].match(C))q++;else{r=l[u+q];break}r.match(/[Mm]/)?
n=!0:a.Nm(!1)}k=a.Fs;Od=a;if(b)for(b=k.figures.iterator;b.next();)b.value.isFilled=!0;return k};N.Ha=function(a,b){for(var c=a.length,d=K.alloc(),e=0;e<c;e++){var f=a[e];d.x=f[0];d.y=f[1];b.Ga(d);f[0]=d.x;f[1]=d.y;d.x=f[2];d.y=f[3];b.Ga(d);f[2]=d.x;f[3]=d.y;d.x=f[4];d.y=f[5];b.Ga(d);f[4]=d.x;f[5]=d.y;d.x=f[6];d.y=f[7];b.Ga(d);f[6]=d.x;f[7]=d.y}K.free(d)};N.prototype.sv=function(){if(this.wa||this.nr!==this.figures.w)return!0;for(var a=this.figures.m,b=a.length,c=0;c<b;c++)if(a[c].sv())return!0;return!1};
N.prototype.computeBounds=function(){this.wa=!1;this.an=this.Jk=null;this.bn=NaN;this.nr=this.figures.w;for(var a=this.figures.m,b=a.length,c=0;c<b;c++){var d=a[c];d.wa=!1;var e=d.segments;d.bs=e.w;d=e.m;e=d.length;for(var f=0;f<e;f++){var g=d[f];g.wa=!1;g.Xd=null}}a=this.$q;a.ka();isNaN(this.nl)||isNaN(this.ml)?a.h(0,0,0,0):a.h(0,0,this.nl,this.ml);Pd(this,a,!1);ic(a,0,0,0,0);a.freeze()};N.prototype.Sx=function(){var a=new M;Pd(this,a,!0);return a};
function Pd(a,b,c){switch(a.type){case N.j:case N.F:case N.O:c?b.h(a.hd,a.jd,0,0):ic(b,a.hd,a.jd,0,0);ic(b,a.oc,a.yc,0,0);break;case N.o:var d=a.figures;a=d.m;d=d.length;for(var e=0;e<d;e++){var f=a[e];c&&0===e?b.h(f.startX,f.startY,0,0):ic(b,f.startX,f.startY,0,0);for(var g=f.segments.m,h=g.length,k=f.startX,l=f.startY,m=0;m<h;m++){var n=g[m];switch(n.type){case Dd:case Qd:k=n.endX;l=n.endY;ic(b,k,l,0,0);break;case Rd:L.fm(k,l,n.point1X,n.point1Y,n.point2X,n.point2Y,n.endX,n.endY,.5,b);k=n.endX;
l=n.endY;break;case Sd:L.Hv(k,l,n.point1X,n.point1Y,n.endX,n.endY,.5,b);k=n.endX;l=n.endY;break;case Td:case ee:var p=n.type===Td?fe(n,f):ge(n,f,k,l),r=p.length;if(0===r){k=n.type===Td?n.centerX:n.endX;l=n.type===Td?n.centerY:n.endY;ic(b,k,l,0,0);break}n=null;for(var q=0;q<r;q++)n=p[q],L.fm(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],.5,b);null!==n&&(k=n[6],l=n[7]);break;default:v("Unknown Segment type: "+n.type)}}}break;default:v("Unknown Geometry type: "+a.type)}}
N.prototype.normalize=function(){this.u&&xa(this);var a=this.Sx();this.offset(-a.x,-a.y);return new K(-a.x,-a.y)};N.prototype.offset=function(a,b){this.u&&xa(this);G&&(E(a,N,"offset"),E(b,N,"offset"));this.transform(1,0,0,1,a,b);return this};N.prototype.scale=function(a,b){this.u&&xa(this);G&&(E(a,N,"scale:x"),E(b,N,"scale:y"),0===a&&Ba(a,"scale must be non-zero",N,"scale:x"),0===b&&Ba(b,"scale must be non-zero",N,"scale:y"));this.transform(a,0,0,b,0,0);return this};
N.prototype.rotate=function(a,b,c){this.u&&xa(this);void 0===b&&(b=0);void 0===c&&(c=0);G&&(E(a,N,"rotate:angle"),E(b,N,"rotate:x"),E(c,N,"rotate:y"));var d=Jb.alloc();d.reset();d.rotate(a,b,c);this.transform(d.m11,d.m12,d.m21,d.m22,d.dx,d.dy);Jb.free(d);return this};t=N.prototype;
t.transform=function(a,b,c,d,e,f){switch(this.type){case N.j:case N.F:case N.O:var g=this.hd;var h=this.jd;this.hd=g*a+h*c+e;this.jd=g*b+h*d+f;g=this.oc;h=this.yc;this.oc=g*a+h*c+e;this.yc=g*b+h*d+f;break;case N.o:for(var k=this.figures.m,l=k.length,m=0;m<l;m++){var n=k[m];g=n.startX;h=n.startY;n.startX=g*a+h*c+e;n.startY=g*b+h*d+f;n=n.segments.m;for(var p=n.length,r=0;r<p;r++){var q=n[r];switch(q.type){case Dd:case Qd:g=q.endX;h=q.endY;q.endX=g*a+h*c+e;q.endY=g*b+h*d+f;break;case Rd:g=q.point1X;
h=q.point1Y;q.point1X=g*a+h*c+e;q.point1Y=g*b+h*d+f;g=q.point2X;h=q.point2Y;q.point2X=g*a+h*c+e;q.point2Y=g*b+h*d+f;g=q.endX;h=q.endY;q.endX=g*a+h*c+e;q.endY=g*b+h*d+f;break;case Sd:g=q.point1X;h=q.point1Y;q.point1X=g*a+h*c+e;q.point1Y=g*b+h*d+f;g=q.endX;h=q.endY;q.endX=g*a+h*c+e;q.endY=g*b+h*d+f;break;case Td:g=q.centerX;h=q.centerY;q.centerX=g*a+h*c+e;q.centerY=g*b+h*d+f;0!==b&&(g=180*Math.atan2(b,a)/Math.PI,0>g&&(g+=360),q.startAngle+=g);0>a&&(q.startAngle=180-q.startAngle,q.sweepAngle=-q.sweepAngle);
0>d&&(q.startAngle=-q.startAngle,q.sweepAngle=-q.sweepAngle);q.radiusX*=Math.sqrt(a*a+c*c);void 0!==q.radiusY&&(q.radiusY*=Math.sqrt(b*b+d*d));break;case ee:g=q.endX;h=q.endY;q.endX=g*a+h*c+e;q.endY=g*b+h*d+f;if(0===q.radiusX||0===q.radiusY)break;0!==b&&(g=180*Math.atan2(b,a)/Math.PI,0>g&&(g+=360),q.xAxisRotation+=g);0>a&&(q.xAxisRotation=180-q.xAxisRotation,q.isClockwiseArc=!q.isClockwiseArc);0>d&&(q.xAxisRotation=-q.xAxisRotation,q.isClockwiseArc=!q.isClockwiseArc);q.radiusX*=Math.sqrt(a*a+c*c);
q.radiusY*=Math.sqrt(b*b+d*d);break;default:v("Unknown Segment type: "+q.type)}}}}this.wa=!0;return this};
t.ca=function(a,b){void 0===b&&(b=0);var c=this.hd,d=this.jd,e=this.oc,f=this.yc;switch(this.type){case N.j:return L.Sb(c,d,e,f,b,a.x,a.y);case N.F:var g=M.allocAt(Math.min(c,e)-b,Math.min(d,f)-b,Math.abs(e-c)+2*b,Math.abs(f-d)+2*b);a=g.ca(a);M.free(g);return a;case N.O:g=Math.min(c,e)-b;var h=Math.min(d,f)-b;c=(Math.abs(e-c)+2*b)/2;b=(Math.abs(f-d)+2*b)/2;if(0>=c||0>=b)return!1;g=a.x-(g+c);h=a.y-(h+b);return 1>=g*g/(c*c)+h*h/(b*b);case N.o:return he(this,a,b,!0,!1);default:return!1}};
function he(a,b,c,d,e){var f=b.x;b=b.y;for(var g=a.bounds.x-20,h=0,k,l,m,n,p=a.figures.m,r=p.length,q=0;q<r;q++){var u=p[q];if(u.isFilled){if(d&&u.ca(f,b,c))return!0;var x=u.segments;k=u.startX;l=u.startY;for(var y=k,z=l,B=x.m,D=0;D<=x.length;D++){var C=void 0;if(D!==x.length){C=B[D];var J=C.type;a=C.endX;n=C.endY}else J=Dd,a=y,n=z;switch(J){case Qd:y=ie(f,b,g,b,k,l,y,z);if(isNaN(y))return!0;h+=y;y=a;z=n;break;case Dd:k=ie(f,b,g,b,k,l,a,n);if(isNaN(k))return!0;h+=k;break;case Rd:m=L.aq(k,l,C.point1X,
C.point1Y,C.point2X,C.point2Y,a,n,g,b,f,b,.5);h+=m;break;case Sd:m=L.aq(k,l,(k+2*C.point1X)/3,(l+2*C.point1Y)/3,(2*C.point1X+a)/3,(2*C.point1Y+n)/3,a,n,g,b,f,b,.5);h+=m;break;case Td:case ee:J=C.type===Td?fe(C,u):ge(C,u,k,l);var S=J.length;if(0===S){k=ie(f,b,g,b,k,l,C.type===Td?C.centerX:C.endX,C.type===Td?C.centerY:C.endY);if(isNaN(k))return!0;h+=k;break}C=null;for(var T=0;T<S;T++){C=J[T];if(0===T){m=ie(f,b,g,b,k,l,C[0],C[1]);if(isNaN(m))return!0;h+=m}m=L.aq(C[0],C[1],C[2],C[3],C[4],C[5],C[6],C[7],
g,b,f,b,.5);h+=m}null!==C&&(a=C[6],n=C[7]);break;default:v("Unknown Segment type: "+C.type)}k=a;l=n}if(0!==h)return!0;h=0}else if(u.ca(f,b,e?c:c+2))return!0}return 0!==h}
function ie(a,b,c,d,e,f,g,h){if(L.Sb(e,f,g,h,.05,a,b))return NaN;var k=(a-c)*(f-h);if(0===k)return 0;var l=((a*d-b*c)*(e-g)-(a-c)*(e*h-f*g))/k;b=(a*d-b*c)*(f-h)/k;if(l>=a)return 0;if((e>g?e-g:g-e)<(f>h?f-h:h-f))if(f<h){if(b<f||b>h)return 0}else{if(b<h||b>f)return 0}else if(e<g){if(l<e||l>g)return 0}else if(l<g||l>e)return 0;return 0<k?1:-1}function je(a,b,c,d){a=a.figures.m;for(var e=a.length,f=0;f<e;f++)if(a[f].ca(b,c,d))return!0;return!1}
t.hv=function(a,b){0>a?a=0:1<a&&(a=1);void 0===b&&(b=new K);if(this.type===N.j)return b.h(this.startX+a*(this.endX-this.startX),this.startY+a*(this.endY-this.startY)),b;for(var c=this.flattenedSegments,d=this.flattenedLengths,e=c.length,f=this.flattenedTotalLength*a,g=0,h=0;h<e;h++){var k=d[h],l=k.length;for(a=0;a<l;a++){var m=k[a];if(g+m>=f)return d=f-g,d=0===m?0:d/m,c=c[h],h=c[2*a],e=c[2*a+1],b.h(h+(c[2*a+2]-h)*d,e+(c[2*a+3]-e)*d),b;g+=m}}return b};
t.iy=function(a){0>a?a=0:1<a&&(a=1);if(this.type===N.j)return 180*Math.atan2(this.endY-this.startY,this.endX-this.startX)/Math.PI;for(var b=this.flattenedSegments,c=this.flattenedLengths,d=b.length,e=this.flattenedTotalLength*a,f=0,g=0;g<d;g++){var h=c[g],k=h.length;for(a=0;a<k;a++){var l=h[a];if(f+l>=e)return e=b[g],b=e[2*a],c=e[2*a+1],d=e[2*a+2],a=e[2*a+3],1>Math.abs(d-b)&&1>Math.abs(a-c)?0:1>Math.abs(d-b)?0<=a-c?90:270:1>Math.abs(a-c)?0<=d-b?0:180:180*Math.atan2(a-c,d-b)/Math.PI;f+=l}}return NaN};
t.iv=function(a,b){0>a?a=0:1<a&&(a=1);void 0===b&&(b=[]);b.length=3;if(this.type===N.j)return b[0]=this.startX+a*(this.endX-this.startX),b[1]=this.startY+a*(this.endY-this.startY),b[2]=180*Math.atan2(this.endY-this.startY,this.endX-this.startX)/Math.PI,b;for(var c=this.flattenedSegments,d=this.flattenedLengths,e=c.length,f=this.flattenedTotalLength*a,g=0,h=0;h<e;h++){var k=d[h],l=k.length;for(a=0;a<l;a++){var m=k[a];if(g+m>=f)return d=f-g,d=0===m?0:d/m,m=c[h],c=m[2*a],h=m[2*a+1],e=m[2*a+2],a=m[2*
a+3],b[0]=c+(e-c)*d,b[1]=h+(a-h)*d,b[2]=1>Math.abs(e-c)&&1>Math.abs(a-h)?0:1>Math.abs(e-c)?0<=a-h?90:270:1>Math.abs(a-h)?0<=e-c?0:180:180*Math.atan2(a-h,e-c)/Math.PI,b;g+=m}}return b};
t.jy=function(a){if(this.type===N.j){var b=this.startX,c=this.startY,d=this.endX,e=this.endY;if(b!==d||c!==e){var f=a.x;a=a.y;if(b===d){if(c<e){var g=c;d=e}else g=e,d=c;return a<=g?g===c?0:1:a>=d?d===c?0:1:Math.abs(a-c)/(d-g)}if(c===e)return b<d?g=b:(g=d,d=b),f<=g?g===b?0:1:f>=d?d===b?0:1:Math.abs(f-b)/(d-g);g=(d-b)*(d-b)+(e-c)*(e-c);var h=K.alloc();L.Th(b,c,d,e,f,a,h);a=h.x;f=h.y;K.free(h);return Math.sqrt(((a-b)*(a-b)+(f-c)*(f-c))/g)}}else if(this.type===N.F){g=this.startX;h=this.startY;var k=this.endX;
e=this.endY;if(g!==k||h!==e){b=k-g;c=e-h;f=2*b+2*c;d=a.x;a=a.y;d=Math.min(Math.max(d,g),k);a=Math.min(Math.max(a,h),e);g=Math.abs(d-g);k=Math.abs(d-k);h=Math.abs(a-h);e=Math.abs(a-e);var l=Math.min(g,k,h,e);if(l===h)return d/f;if(l===k)return(b+a)/f;if(l===e)return(2*b+c-d)/f;if(l===g)return(2*b+2*c-a)/f}}else{b=this.flattenedSegments;c=this.flattenedLengths;f=this.flattenedTotalLength;d=K.alloc();e=Infinity;h=g=0;k=b.length;for(var m=l=0,n=0;n<k;n++)for(var p=b[n],r=c[n],q=p.length,u=0;u<q;u+=2){var x=
p[u],y=p[u+1];if(0!==u){L.Th(l,m,x,y,a.x,a.y,d);var z=(d.x-a.x)*(d.x-a.x)+(d.y-a.y)*(d.y-a.y);z<e&&(e=z,g=h,g+=Math.sqrt((d.x-l)*(d.x-l)+(d.y-m)*(d.y-m)));h+=r[(u-2)/2]}l=x;m=y}K.free(d);a=g/f;return 0>a?0:1<a?1:a}return 0};
function ke(a){if(null===a.Jk){var b=a.Jk=[],c=a.an=[],d=[],e=[];if(a.type===N.j)d.push(a.startX),d.push(a.startY),d.push(a.endX),d.push(a.endY),b.push(d),e.push(Math.sqrt((a.startX-a.endX)*(a.startX-a.endX)+(a.startY-a.endY)*(a.startY-a.endY))),c.push(e);else if(a.type===N.F)d.push(a.startX),d.push(a.startY),d.push(a.endX),d.push(a.startY),d.push(a.endX),d.push(a.endY),d.push(a.startX),d.push(a.endY),d.push(a.startX),d.push(a.startY),b.push(d),e.push(Math.abs(a.startX-a.endX)),e.push(Math.abs(a.startY-
a.endY)),e.push(Math.abs(a.startX-a.endX)),e.push(Math.abs(a.startY-a.endY)),c.push(e);else if(a.type===N.O){var f=new le;f.startX=a.endX;f.startY=(a.startY+a.endY)/2;var g=new me(Td);g.startAngle=0;g.sweepAngle=360;g.centerX=(a.startX+a.endX)/2;g.centerY=(a.startY+a.endY)/2;g.radiusX=Math.abs(a.startX-a.endX)/2;g.radiusY=Math.abs(a.startY-a.endY)/2;f.add(g);a=fe(g,f);e=a.length;if(0===e)d.push(g.centerX),d.push(g.centerY);else{g=f.startX;f=f.startY;for(var h=0;h<e;h++){var k=a[h];L.Se(g,f,k[2],k[3],
k[4],k[5],k[6],k[7],.5,d);g=k[6];f=k[7]}}b.push(d);c.push(ne(d))}else for(a=a.figures.iterator;a.next();){e=a.value;d=[];d.push(e.startX);d.push(e.startY);g=e.startX;f=e.startY;h=g;k=f;for(var l=e.segments.m,m=l.length,n=0;n<m;n++){var p=l[n];switch(p.type){case Qd:4<=d.length&&(b.push(d),c.push(ne(d)));d=[];d.push(p.endX);d.push(p.endY);g=p.endX;f=p.endY;h=g;k=f;break;case Dd:d.push(p.endX);d.push(p.endY);g=p.endX;f=p.endY;break;case Rd:L.Se(g,f,p.point1X,p.point1Y,p.point2X,p.point2Y,p.endX,p.endY,
.5,d);g=p.endX;f=p.endY;break;case Sd:L.yq(g,f,p.point1X,p.point1Y,p.endX,p.endY,.5,d);g=p.endX;f=p.endY;break;case Td:var r=fe(p,e),q=r.length;if(0===q){d.push(p.centerX);d.push(p.centerY);g=p.centerX;f=p.centerY;break}for(var u=0;u<q;u++){var x=r[u];L.Se(g,f,x[2],x[3],x[4],x[5],x[6],x[7],.5,d);g=x[6];f=x[7]}break;case ee:r=ge(p,e,g,f);q=r.length;u=p.endX;x=p.endY;if(0===q){d.push(u);d.push(x);g=u;f=x;break}for(u=0;u<q;u++)x=r[u],L.Se(g,f,x[2],x[3],x[4],x[5],x[6],x[7],.5,d),g=x[6],f=x[7];break;default:v("Segment not of valid type: "+
p.type)}p.isClosed&&(d.push(h),d.push(k))}4<=d.length&&(b.push(d),c.push(ne(d)))}}}function ne(a){for(var b=[],c=0,d=0,e=a.length,f=0;f<e;f+=2){var g=a[f],h=a[f+1];0!==f&&(c=Math.sqrt(Mb(c,d,g,h)),b.push(c));c=g;d=h}return b}t.add=function(a){this.sj.add(a);return this};t.Om=function(a,b,c,d,e,f,g,h){this.u&&xa(this);this.zf=(new Ib(a,b,e,f)).freeze();this.Af=(new Ib(c,d,g,h)).freeze();return this};
na.Object.defineProperties(N.prototype,{flattenedSegments:{configurable:!0,get:function(){ke(this);return this.Jk}},flattenedLengths:{configurable:!0,get:function(){ke(this);return this.an}},flattenedTotalLength:{configurable:!0,get:function(){var a=this.bn;if(isNaN(a)){if(this.type===N.j){a=Math.abs(this.endX-this.startX);var b=Math.abs(this.endY-this.startY);a=Math.sqrt(a*a+b*b)}else if(this.type===N.F)a=2*Math.abs(this.endX-this.startX)+2*Math.abs(this.endY-
this.startY);else{b=this.flattenedLengths;for(var c=b.length,d=a=0;d<c;d++)for(var e=b[d],f=e.length,g=0;g<f;g++)a+=e[g]}this.bn=a}return a}},type:{configurable:!0,get:function(){return this.na},set:function(a){this.na!==a&&(G&&db(a,N,N,"type"),this.u&&xa(this,a),this.na=a,this.wa=!0)}},startX:{configurable:!0,get:function(){return this.hd},set:function(a){this.hd!==a&&(G&&E(a,N,"startX"),this.u&&xa(this,a),this.hd=a,this.wa=!0)}},startY:{configurable:!0,
get:function(){return this.jd},set:function(a){this.jd!==a&&(G&&E(a,N,"startY"),this.u&&xa(this,a),this.jd=a,this.wa=!0)}},endX:{configurable:!0,get:function(){return this.oc},set:function(a){this.oc!==a&&(G&&E(a,N,"endX"),this.u&&xa(this,a),this.oc=a,this.wa=!0)}},endY:{configurable:!0,get:function(){return this.yc},set:function(a){this.yc!==a&&(G&&E(a,N,"endY"),this.u&&xa(this,a),this.yc=a,this.wa=!0)}},figures:{configurable:!0,get:function(){return this.sj},
set:function(a){this.sj!==a&&(G&&w(a,H,N,"figures"),this.u&&xa(this,a),this.sj=a,this.wa=!0)}},spot1:{configurable:!0,get:function(){return this.zf},set:function(a){G&&w(a,Ib,N,"spot1");this.u&&xa(this,a);this.zf=a.L()}},spot2:{configurable:!0,get:function(){return this.Af},set:function(a){G&&w(a,Ib,N,"spot2");this.u&&xa(this,a);this.Af=a.L()}},defaultStretch:{configurable:!0,get:function(){return this.$f},set:function(a){G&&db(a,O,N,"stretch");this.u&&xa(this,
a);this.$f=a}},bounds:{configurable:!0,get:function(){this.sv()&&this.computeBounds();return this.$q}}});N.prototype.setSpots=N.prototype.Om;N.prototype.add=N.prototype.add;N.prototype.getFractionForPoint=N.prototype.jy;N.prototype.getPointAndAngleAlongPath=N.prototype.iv;N.prototype.getAngleAlongPath=N.prototype.iy;N.prototype.getPointAlongPath=N.prototype.hv;N.prototype.containsPoint=N.prototype.ca;N.prototype.transform=N.prototype.transform;N.prototype.rotate=N.prototype.rotate;
N.prototype.scale=N.prototype.scale;N.prototype.offset=N.prototype.offset;N.prototype.normalize=N.prototype.normalize;N.prototype.computeBoundsWithoutOrigin=N.prototype.Sx;N.prototype.equalsApprox=N.prototype.Za;N.className="Geometry";N.j=new F(N,"Line",0);N.F=new F(N,"Rectangle",1);N.O=new F(N,"Ellipse",2);N.o=new F(N,"Path",3);N.Vb="UuBbMmZzLlHhVvCcSsQqTtAaFfXx";N.className="Geometry";N.stringify=N.Da;N.fillPath=N.Ra;N.parse=N.parse;N.Line=N.j;N.Rectangle=N.F;N.Ellipse=N.O;N.Path=N.o;
function le(a,b,c,d){ab(this);this.Sw=null;this.u=!1;void 0===c&&(c=!0);this.xr=c;void 0===d&&(d=!0);this.Cr=d;void 0!==a?(G&&E(a,le,"sx"),this.hd=a):this.hd=0;void 0!==b?(G&&E(b,le,"sy"),this.jd=b):this.jd=0;this.Pl=new H;this.bs=this.Pl.w;this.wa=!0}le.prototype.copy=function(){var a=new le;a.xr=this.xr;a.Cr=this.Cr;a.hd=this.hd;a.jd=this.jd;for(var b=this.Pl.m,c=b.length,d=a.Pl,e=0;e<c;e++){var f=b[e].copy();d.add(f)}a.bs=this.bs;a.wa=this.wa;a.Sw=this.Sw;return a};t=le.prototype;
t.Za=function(a){if(!(a instanceof le&&L.A(this.startX,a.startX)&&L.A(this.startY,a.startY)))return!1;var b=this.segments.m;a=a.segments.m;var c=b.length;if(c!==a.length)return!1;for(var d=0;d<c;d++)if(!b[d].Za(a[d]))return!1;return!0};t.toString=function(a){void 0===a&&(a=-1);var b=0>a?"M"+this.startX.toString()+" "+this.startY.toString():"M"+this.startX.toFixed(a)+" "+this.startY.toFixed(a);for(var c=this.segments.m,d=c.length,e=0;e<d;e++)b+=" "+c[e].toString(a);return b};
t.freeze=function(){this.u=!0;var a=this.segments;a.freeze();var b=a.m;a=a.length;for(var c=0;c<a;c++)b[c].freeze();return this};t.ka=function(){this.u=!1;var a=this.segments;a.ka();a=a.m;for(var b=a.length,c=0;c<b;c++)a[c].ka();return this};t.sv=function(){if(this.wa)return!0;var a=this.segments;if(this.bs!==a.w)return!0;a=a.m;for(var b=a.length,c=0;c<b;c++)if(a[c].wa)return!0;return!1};t.add=function(a){this.Pl.add(a);return this};
t.ca=function(a,b,c){for(var d=this.startX,e=this.startY,f=d,g=e,h=this.segments.m,k=h.length,l=0;l<k;l++){var m=h[l];switch(m.type){case Qd:f=m.endX;g=m.endY;d=m.endX;e=m.endY;break;case Dd:if(L.Sb(d,e,m.endX,m.endY,c,a,b))return!0;d=m.endX;e=m.endY;break;case Rd:if(L.vs(d,e,m.point1X,m.point1Y,m.point2X,m.point2Y,m.endX,m.endY,.5,a,b,c))return!0;d=m.endX;e=m.endY;break;case Sd:if(L.Iv(d,e,m.point1X,m.point1Y,m.endX,m.endY,.5,a,b,c))return!0;d=m.endX;e=m.endY;break;case Td:case ee:var n=m.type===
Td?fe(m,this):ge(m,this,d,e),p=n.length,r=m.type===Td?m.centerX:m.endX,q=m.type===Td?m.centerY:m.endY;if(0===p){if(L.Sb(d,e,r,q,c,a,b))return!0;d=r;e=q;break}r=null;for(q=0;q<p;q++)if(r=n[q],0===q&&L.Sb(d,e,r[0],r[1],c,a,b)||L.vs(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],.5,a,b,c))return!0;null!==r&&(d=r[6],e=r[7]);break;default:v("Unknown Segment type: "+m.type)}if(m.isClosed&&(d!==f||e!==g)&&L.Sb(d,e,f,g,c,a,b))return!0}return!1};
na.Object.defineProperties(le.prototype,{isFilled:{configurable:!0,get:function(){return this.xr},set:function(a){G&&A(a,"boolean",le,"isFilled");this.u&&xa(this,a);this.xr=a}},isShadowed:{configurable:!0,get:function(){return this.Cr},set:function(a){G&&A(a,"boolean",le,"isShadowed");this.u&&xa(this,a);this.Cr=a}},startX:{configurable:!0,get:function(){return this.hd},set:function(a){G&&E(a,le,"startX");this.u&&xa(this,a);this.hd=a;this.wa=!0}},startY:{configurable:!0,
enumerable:!0,get:function(){return this.jd},set:function(a){G&&E(a,le,"startY");this.u&&xa(this,a);this.jd=a;this.wa=!0}},segments:{configurable:!0,get:function(){return this.Pl},set:function(a){G&&w(a,H,le,"segments");this.u&&xa(this,a);this.Pl=a;this.wa=!0}}});le.prototype.add=le.prototype.add;le.prototype.equalsApprox=le.prototype.Za;le.className="PathFigure";
function me(a,b,c,d,e,f,g,h){ab(this);this.u=!1;void 0===a?a=Dd:G&&db(a,me,me,"constructor:type");this.na=a;void 0!==b?(G&&E(b,me,"ex"),this.oc=b):this.oc=0;void 0!==c?(G&&E(c,me,"ey"),this.yc=c):this.yc=0;void 0===d&&(d=0);void 0===e&&(e=0);void 0===f&&(f=0);void 0===g&&(g=0);a===ee?(a=f%360,0>a&&(a+=360),this.Oe=a,this.Bi=0,G&&E(d,me,"x1"),this.Ci=Math.max(d,0),G&&E(e,me,"y1"),this.qh=Math.max(e,0),this.ul="boolean"===typeof g?g:"number"===typeof g?!!g:!1,this.Pk=!!h):(G&&E(d,me,"x1"),this.Oe=d,
G&&E(e,me,"y1"),this.Bi=e,G&&E(f,me,"x2"),a===Td&&(f=Math.max(f,0)),this.Ci=f,"number"===typeof g?(a===Td&&(g=Math.max(g,0)),this.qh=g):this.qh=0,this.Pk=this.ul=!1);this.yj=!1;this.wa=!0;this.Xd=null}me.prototype.copy=function(){var a=new me;a.na=this.na;a.oc=this.oc;a.yc=this.yc;a.Oe=this.Oe;a.Bi=this.Bi;a.Ci=this.Ci;a.qh=this.qh;a.ul=this.ul;a.Pk=this.Pk;a.yj=this.yj;a.wa=this.wa;return a};t=me.prototype;
t.Za=function(a){if(!(a instanceof me)||this.type!==a.type||this.isClosed!==a.isClosed)return!1;switch(this.type){case Qd:case Dd:return L.A(this.endX,a.endX)&&L.A(this.endY,a.endY);case Rd:return L.A(this.endX,a.endX)&&L.A(this.endY,a.endY)&&L.A(this.point1X,a.point1X)&&L.A(this.point1Y,a.point1Y)&&L.A(this.point2X,a.point2X)&&L.A(this.point2Y,a.point2Y);case Sd:return L.A(this.endX,a.endX)&&L.A(this.endY,a.endY)&&L.A(this.point1X,a.point1X)&&L.A(this.point1Y,a.point1Y);case Td:return L.A(this.startAngle,
a.startAngle)&&L.A(this.sweepAngle,a.sweepAngle)&&L.A(this.centerX,a.centerX)&&L.A(this.centerY,a.centerY)&&L.A(this.radiusX,a.radiusX)&&L.A(this.radiusY,a.radiusY);case ee:return this.isClockwiseArc===a.isClockwiseArc&&this.isLargeArc===a.isLargeArc&&L.A(this.xAxisRotation,a.xAxisRotation)&&L.A(this.endX,a.endX)&&L.A(this.endY,a.endY)&&L.A(this.radiusX,a.radiusX)&&L.A(this.radiusY,a.radiusY);default:return!1}};t.mb=function(a){a.classType===me?this.type=a:Ea(this,a)};
t.toString=function(a){void 0===a&&(a=-1);switch(this.type){case Qd:a=0>a?"M"+this.endX.toString()+" "+this.endY.toString():"M"+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;case Dd:a=0>a?"L"+this.endX.toString()+" "+this.endY.toString():"L"+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;case Rd:a=0>a?"C"+this.point1X.toString()+" "+this.point1Y.toString()+" "+this.point2X.toString()+" "+this.point2Y.toString()+" "+this.endX.toString()+" "+this.endY.toString():"C"+this.point1X.toFixed(a)+
" "+this.point1Y.toFixed(a)+" "+this.point2X.toFixed(a)+" "+this.point2Y.toFixed(a)+" "+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;case Sd:a=0>a?"Q"+this.point1X.toString()+" "+this.point1Y.toString()+" "+this.endX.toString()+" "+this.endY.toString():"Q"+this.point1X.toFixed(a)+" "+this.point1Y.toFixed(a)+" "+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;case Td:a=0>a?"B"+this.startAngle.toString()+" "+this.sweepAngle.toString()+" "+this.centerX.toString()+" "+this.centerY.toString()+
" "+this.radiusX.toString()+" "+this.radiusY.toString():"B"+this.startAngle.toFixed(a)+" "+this.sweepAngle.toFixed(a)+" "+this.centerX.toFixed(a)+" "+this.centerY.toFixed(a)+" "+this.radiusX.toFixed(a)+" "+this.radiusY.toFixed(a);break;case ee:a=0>a?"A"+this.radiusX.toString()+" "+this.radiusY.toString()+" "+this.xAxisRotation.toString()+" "+(this.isLargeArc?1:0)+" "+(this.isClockwiseArc?1:0)+" "+this.endX.toString()+" "+this.endY.toString():"A"+this.radiusX.toFixed(a)+" "+this.radiusY.toFixed(a)+
" "+this.xAxisRotation.toFixed(a)+" "+(this.isLargeArc?1:0)+" "+(this.isClockwiseArc?1:0)+" "+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;default:a=this.type.toString()}return a+(this.yj?"z":"")};t.freeze=function(){this.u=!0;return this};t.ka=function(){this.u=!1;return this};t.close=function(){this.yj=!0;return this};
function fe(a,b){if(null!==a.Xd&&!1===b.wa)return a.Xd;var c=a.radiusX,d=a.radiusY;void 0===d&&(d=c);if(0===c||0===d)return a.Xd=[],a.Xd;b=a.Oe;var e=a.Bi,f=L.Tx(0,0,c<d?c:d,a.startAngle,a.startAngle+a.sweepAngle,!1);if(c!==d){var g=Jb.alloc();g.reset();c<d?g.scale(1,d/c):g.scale(c/d,1);N.Ha(f,g);Jb.free(g)}c=f.length;for(d=0;d<c;d++)g=f[d],g[0]+=b,g[1]+=e,g[2]+=b,g[3]+=e,g[4]+=b,g[5]+=e,g[6]+=b,g[7]+=e;a.Xd=f;return a.Xd}
function ge(a,b,c,d){function e(a,b,c,d){return(a*d<b*c?-1:1)*Math.acos((a*c+b*d)/(Math.sqrt(a*a+b*b)*Math.sqrt(c*c+d*d)))}if(null!==a.Xd&&!1===b.wa)return a.Xd;if(0===a.radiusX||0===a.radiusY)return a.Xd=[],a.Xd;b=a.Ci;var f=a.qh;0===b&&(b=1E-4);0===f&&(f=1E-4);var g=Math.PI/180*a.Oe,h=a.ul,k=a.Pk,l=a.oc,m=a.yc,n=Math.cos(g),p=Math.sin(g),r=n*(c-l)/2+p*(d-m)/2;g=-p*(c-l)/2+n*(d-m)/2;var q=r*r/(b*b)+g*g/(f*f);1<q&&(b*=Math.sqrt(q),f*=Math.sqrt(q));q=(h===k?-1:1)*Math.sqrt((b*b*f*f-b*b*g*g-f*f*r*r)/
(b*b*g*g+f*f*r*r));isNaN(q)&&(q=0);h=q*b*g/f;q=q*-f*r/b;isNaN(h)&&(h=0);isNaN(q)&&(q=0);c=(c+l)/2+n*h-p*q;d=(d+m)/2+p*h+n*q;m=e(1,0,(r-h)/b,(g-q)/f);n=(r-h)/b;l=(g-q)/f;r=(-r-h)/b;h=(-g-q)/f;g=e(n,l,r,h);r=(n*r+l*h)/(Math.sqrt(n*n+l*l)*Math.sqrt(r*r+h*h));-1>=r?g=Math.PI:1<=r&&(g=0);!k&&0<g&&(g-=2*Math.PI);k&&0>g&&(g+=2*Math.PI);k=b>f?1:b/f;r=b>f?f/b:1;b=L.Tx(0,0,b>f?b:f,m,m+g,!0);f=Jb.alloc();f.reset();f.translate(c,d);f.rotate(a.Oe,0,0);f.scale(k,r);N.Ha(b,f);Jb.free(f);a.Xd=b;return a.Xd}
na.Object.defineProperties(me.prototype,{isClosed:{configurable:!0,get:function(){return this.yj},set:function(a){this.yj!==a&&(this.yj=a,this.wa=!0)}},type:{configurable:!0,get:function(){return this.na},set:function(a){G&&db(a,me,me,"type");this.u&&xa(this,a);this.na=a;this.wa=!0}},endX:{configurable:!0,get:function(){return this.oc},set:function(a){G&&E(a,me,"endX");this.u&&xa(this,a);this.oc=a;this.wa=!0}},endY:{configurable:!0,get:function(){return this.yc},
set:function(a){G&&E(a,me,"endY");this.u&&xa(this,a);this.yc=a;this.wa=!0}},point1X:{configurable:!0,get:function(){return this.Oe},set:function(a){G&&E(a,me,"point1X");this.u&&xa(this,a);this.Oe=a;this.wa=!0}},point1Y:{configurable:!0,get:function(){return this.Bi},set:function(a){G&&E(a,me,"point1Y");this.u&&xa(this,a);this.Bi=a;this.wa=!0}},point2X:{configurable:!0,get:function(){return this.Ci},set:function(a){G&&E(a,me,"point2X");this.u&&xa(this,a);this.Ci=
a;this.wa=!0}},point2Y:{configurable:!0,get:function(){return this.qh},set:function(a){G&&E(a,me,"point2Y");this.u&&xa(this,a);this.qh=a;this.wa=!0}},centerX:{configurable:!0,get:function(){return this.Oe},set:function(a){G&&E(a,me,"centerX");this.u&&xa(this,a);this.Oe=a;this.wa=!0}},centerY:{configurable:!0,get:function(){return this.Bi},set:function(a){G&&E(a,me,"centerY");this.u&&xa(this,a);this.Bi=a;this.wa=!0}},radiusX:{configurable:!0,
get:function(){return this.Ci},set:function(a){G&&E(a,me,"radiusX");0>a&&Ba(a,">= zero",me,"radiusX");this.u&&xa(this,a);this.Ci=a;this.wa=!0}},radiusY:{configurable:!0,get:function(){return this.qh},set:function(a){G&&E(a,me,"radiusY");0>a&&Ba(a,">= zero",me,"radiusY");this.u&&xa(this,a);this.qh=a;this.wa=!0}},startAngle:{configurable:!0,get:function(){return this.oc},set:function(a){this.oc!==a&&(this.u&&xa(this,a),G&&E(a,me,"startAngle"),a%=360,0>a&&(a+=360),this.oc=
a,this.wa=!0)}},sweepAngle:{configurable:!0,get:function(){return this.yc},set:function(a){G&&E(a,me,"sweepAngle");this.u&&xa(this,a);360<a&&(a=360);-360>a&&(a=-360);this.yc=a;this.wa=!0}},isClockwiseArc:{configurable:!0,get:function(){return this.Pk},set:function(a){this.u&&xa(this,a);this.Pk=a;this.wa=!0}},isLargeArc:{configurable:!0,get:function(){return this.ul},set:function(a){this.u&&xa(this,a);this.ul=a;this.wa=!0}},xAxisRotation:{configurable:!0,
get:function(){return this.Oe},set:function(a){G&&E(a,me,"xAxisRotation");a%=360;0>a&&(a+=360);this.u&&xa(this,a);this.Oe=a;this.wa=!0}}});me.prototype.equalsApprox=me.prototype.Za;var Qd=new F(me,"Move",0),Dd=new F(me,"Line",1),Rd=new F(me,"Bezier",2),Sd=new F(me,"QuadraticBezier",3),Td=new F(me,"Arc",4),ee=new F(me,"SvgArc",4);me.className="PathSegment";me.Move=Qd;me.Line=Dd;me.Bezier=Rd;me.QuadraticBezier=Sd;me.Arc=Td;me.SvgArc=ee;
function oe(){this.D=null;this.Bu=(new K(0,0)).freeze();this.Lt=(new K(0,0)).freeze();this.Tq=this.Lr=0;this.Uq=1;this.oi="";this.rs=this.hr=!1;this.fr=this.Wq=0;this.Jg=this.ur=this.Ar=!1;this.lr=null;this.ps=0;this.vd=this.os=null}oe.prototype.copy=function(){var a=new oe;return this.clone(a)};
oe.prototype.clone=function(a){a.D=this.D;a.Bu.assign(this.viewPoint);a.Lt.assign(this.documentPoint);a.Lr=this.Lr;a.Tq=this.Tq;a.Uq=this.Uq;a.oi=this.oi;a.hr=this.hr;a.rs=this.rs;a.Wq=this.Wq;a.fr=this.fr;a.Ar=this.Ar;a.ur=this.ur;a.Jg=this.Jg;a.lr=this.lr;a.ps=this.ps;a.os=this.os;a.vd=this.vd;return a};
oe.prototype.toString=function(){var a="^";0!==this.modifiers&&(a+="M:"+this.modifiers);0!==this.button&&(a+="B:"+this.button);""!==this.key&&(a+="K:"+this.key);0!==this.clickCount&&(a+="C:"+this.clickCount);0!==this.delta&&(a+="D:"+this.delta);this.handled&&(a+="h");this.bubbles&&(a+="b");null!==this.documentPoint&&(a+="@"+this.documentPoint.toString());return a};oe.prototype.mq=function(a,b){var c=this.diagram;if(null===c)return b;pe(c,this.event,a,b);return b};
oe.prototype.rA=function(a,b){var c=this.diagram;if(null===c)return b;pe(c,this.event,a,b);b.assign(c.jt(b));return b};
na.Object.defineProperties(oe.prototype,{diagram:{configurable:!0,get:function(){return this.D},set:function(a){this.D=a}},viewPoint:{configurable:!0,get:function(){return this.Bu},set:function(a){w(a,K,oe,"viewPoint");this.Bu.assign(a)}},documentPoint:{configurable:!0,get:function(){return this.Lt},set:function(a){w(a,K,oe,"documentPoint");this.Lt.assign(a)}},modifiers:{configurable:!0,get:function(){return this.Lr},set:function(a){this.Lr=
a}},button:{configurable:!0,get:function(){return this.Tq},set:function(a){this.Tq=a;if(null===this.event)switch(a){case 0:this.buttons=1;break;case 1:this.buttons=4;break;case 2:this.buttons=2}}},buttons:{configurable:!0,get:function(){return this.Uq},set:function(a){this.Uq=a}},key:{configurable:!0,get:function(){return this.oi},set:function(a){this.oi=a}},down:{configurable:!0,get:function(){return this.hr},set:function(a){this.hr=a}},up:{configurable:!0,
enumerable:!0,get:function(){return this.rs},set:function(a){this.rs=a}},clickCount:{configurable:!0,get:function(){return this.Wq},set:function(a){this.Wq=a}},delta:{configurable:!0,get:function(){return this.fr},set:function(a){this.fr=a}},isMultiTouch:{configurable:!0,get:function(){return this.Ar},set:function(a){this.Ar=a}},handled:{configurable:!0,get:function(){return this.ur},set:function(a){this.ur=a}},bubbles:{configurable:!0,
get:function(){return this.Jg},set:function(a){this.Jg=a}},event:{configurable:!0,get:function(){return this.lr},set:function(a){this.lr=a}},isTouchEvent:{configurable:!0,get:function(){var a=sa.TouchEvent,b=this.event;return a&&b instanceof a?!0:(a=sa.PointerEvent)&&b instanceof a&&("touch"===b.pointerType||"pen"===b.pointerType)}},timestamp:{configurable:!0,get:function(){return this.ps},set:function(a){this.ps=a}},targetDiagram:{configurable:!0,
get:function(){return this.os},set:function(a){this.os=a}},targetObject:{configurable:!0,get:function(){return this.vd},set:function(a){this.vd=a}},control:{configurable:!0,get:function(){return 0!==(this.modifiers&1)},set:function(a){this.modifiers=a?this.modifiers|1:this.modifiers&-2}},shift:{configurable:!0,get:function(){return 0!==(this.modifiers&4)},set:function(a){this.modifiers=a?this.modifiers|4:this.modifiers&-5}},alt:{configurable:!0,
get:function(){return 0!==(this.modifiers&2)},set:function(a){this.modifiers=a?this.modifiers|2:this.modifiers&-3}},meta:{configurable:!0,get:function(){return 0!==(this.modifiers&8)},set:function(a){this.modifiers=a?this.modifiers|8:this.modifiers&-9}},left:{configurable:!0,get:function(){var a=this.event;return null===a||"mousedown"!==a.type&&"mouseup"!==a.type&&"pointerdown"!==a.type&&"pointerup"!==a.type?0!==(this.buttons&1):0===this.button},set:function(a){this.buttons=
a?this.buttons|1:this.buttons&-2}},right:{configurable:!0,get:function(){var a=this.event;return null===a||"mousedown"!==a.type&&"mouseup"!==a.type&&"pointerdown"!==a.type&&"pointerup"!==a.type?0!==(this.buttons&2):2===this.button},set:function(a){this.buttons=a?this.buttons|2:this.buttons&-3}},middle:{configurable:!0,get:function(){var a=this.event;return null===a||"mousedown"!==a.type&&"mouseup"!==a.type&&"pointerdown"!==a.type&&"pointerup"!==a.type?0!==(this.buttons&
4):1===this.button},set:function(a){this.buttons=a?this.buttons|4:this.buttons&-5}}});oe.prototype.getMultiTouchDocumentPoint=oe.prototype.rA;oe.prototype.getMultiTouchViewPoint=oe.prototype.mq;oe.className="InputEvent";function qe(){this.D=null;this.ta="";this.Tr=this.ks=null}qe.prototype.copy=function(){var a=new qe;a.D=this.D;a.ta=this.ta;a.ks=this.ks;a.Tr=this.Tr;return a};
qe.prototype.toString=function(){var a="*"+this.name;null!==this.subject&&(a+=":"+this.subject.toString());null!==this.parameter&&(a+="("+this.parameter.toString()+")");return a};
na.Object.defineProperties(qe.prototype,{diagram:{configurable:!0,get:function(){return this.D},set:function(a){this.D=a}},name:{configurable:!0,get:function(){return this.ta},set:function(a){this.ta=a}},subject:{configurable:!0,get:function(){return this.ks},set:function(a){this.ks=a}},parameter:{configurable:!0,get:function(){return this.Tr},set:function(a){this.Tr=a}}});qe.className="DiagramEvent";
function re(){this.hn=se;this.tf=this.Kr="";this.No=this.Oo=this.To=this.Uo=this.So=this.D=this.ac=null}re.prototype.clear=function(){this.No=this.Oo=this.To=this.Uo=this.So=this.D=this.ac=null};
re.prototype.copy=function(){var a=new re;a.hn=this.hn;a.Kr=this.Kr;a.tf=this.tf;a.ac=this.ac;a.D=this.D;a.So=this.So;var b=this.Uo;a.Uo=Ga(b)&&"function"===typeof b.L?b.L():b;b=this.To;a.To=Ga(b)&&"function"===typeof b.L?b.L():b;b=this.Oo;a.Oo=Ga(b)&&"function"===typeof b.L?b.L():b;b=this.No;a.No=Ga(b)&&"function"===typeof b.L?b.L():b;return a};re.prototype.mb=function(a){a.classType===re?this.change=a:Ea(this,a)};
re.prototype.toString=function(){var a="";a=this.change===te?a+"* ":this.change===se?a+(null!==this.model?"!m":"!d"):a+((null!==this.model?"!m":"!d")+this.change);this.propertyName&&"string"===typeof this.propertyName&&(a+=" "+this.propertyName);this.modelChange&&this.modelChange!==this.propertyName&&(a+=" "+this.modelChange);a+=": ";this.change===te?null!==this.oldValue&&(a+=" "+this.oldValue):(null!==this.object&&(a+=Ra(this.object)),null!==this.oldValue&&(a+="  old: "+Ra(this.oldValue)),null!==
this.oldParam&&(a+=" "+this.oldParam),null!==this.newValue&&(a+="  new: "+Ra(this.newValue)),null!==this.newParam&&(a+=" "+this.newParam));return a};re.prototype.K=function(a){return a?this.oldValue:this.newValue};re.prototype.tA=function(a){return a?this.oldParam:this.newParam};re.prototype.canUndo=function(){return null!==this.model||null!==this.diagram?!0:!1};
re.prototype.undo=function(){this.canUndo()&&(null!==this.model?this.model.changeState(this,!0):null!==this.diagram&&this.diagram.changeState(this,!0))};re.prototype.canRedo=function(){return null!==this.model||null!==this.diagram?!0:!1};re.prototype.redo=function(){this.canRedo()&&(null!==this.model?this.model.changeState(this,!1):null!==this.diagram&&this.diagram.changeState(this,!1))};
na.Object.defineProperties(re.prototype,{model:{configurable:!0,get:function(){return this.ac},set:function(a){this.ac=a}},diagram:{configurable:!0,get:function(){return this.D},set:function(a){this.D=a}},change:{configurable:!0,get:function(){return this.hn},set:function(a){G&&db(a,re,re,"change");this.hn=a}},modelChange:{configurable:!0,get:function(){return this.Kr},set:function(a){G&&A(a,"string",re,"modelChange");this.Kr=a}},propertyName:{configurable:!0,
enumerable:!0,get:function(){return this.tf},set:function(a){G&&"string"!==typeof a&&A(a,"function",re,"propertyName");this.tf=a}},isTransactionFinished:{configurable:!0,get:function(){return this.hn===te&&("CommittedTransaction"===this.tf||"FinishedUndo"===this.tf||"FinishedRedo"===this.tf)}},object:{configurable:!0,get:function(){return this.So},set:function(a){this.So=a}},oldValue:{configurable:!0,get:function(){return this.Uo},set:function(a){this.Uo=
a}},oldParam:{configurable:!0,get:function(){return this.To},set:function(a){this.To=a}},newValue:{configurable:!0,get:function(){return this.Oo},set:function(a){this.Oo=a}},newParam:{configurable:!0,get:function(){return this.No},set:function(a){this.No=a}}});re.prototype.redo=re.prototype.redo;re.prototype.canRedo=re.prototype.canRedo;re.prototype.undo=re.prototype.undo;re.prototype.canUndo=re.prototype.canUndo;re.prototype.getParam=re.prototype.tA;
re.prototype.getValue=re.prototype.K;re.prototype.clear=re.prototype.clear;var te=new F(re,"Transaction",-1),se=new F(re,"Property",0),ue=new F(re,"Insert",1),ve=new F(re,"Remove",2);re.className="ChangedEvent";re.Transaction=te;re.Property=se;re.Insert=ue;re.Remove=ve;function we(){this.o=(new H).freeze();this.ta="";this.j=!1}
we.prototype.toString=function(a){var b="Transaction: "+this.name+" "+this.changes.count.toString()+(this.isComplete?"":", incomplete");if(void 0!==a&&0<a){a=this.changes.count;for(var c=0;c<a;c++){var d=this.changes.M(c);null!==d&&(b+="\n  "+d.toString())}}return b};we.prototype.clear=function(){var a=this.changes;a.ka();for(var b=a.count-1;0<=b;b--){var c=a.M(b);null!==c&&c.clear()}a.clear();a.freeze()};we.prototype.canUndo=function(){return this.isComplete};
we.prototype.undo=function(){if(this.canUndo())for(var a=this.changes.count-1;0<=a;a--){var b=this.changes.M(a);null!==b&&b.undo()}};we.prototype.canRedo=function(){return this.isComplete};we.prototype.redo=function(){if(this.canRedo())for(var a=this.changes.count,b=0;b<a;b++){var c=this.changes.M(b);null!==c&&c.redo()}};
we.prototype.Zs=function(){if(this.isComplete){var a=this.changes;a.ka();for(var b=new yb,c=0;c<a.count;c++){var d=a.M(c);if(null!==d&&d.change===se&&d.object){var e=b.get(d.object);e||(e=new yb,b.set(d.object,e));var f=e.get(d.propertyName);null===f?e.set(d.propertyName,-1):(0<f&&a.Vc(f,null),e.set(d.propertyName,c))}}for(c=b=0;c<a.count;c++)d=a.M(c),null!==d&&(c>b&&a.Vc(b,d),b++);for(;a.length>b;)a.pop();a.freeze()}};
na.Object.defineProperties(we.prototype,{changes:{configurable:!0,get:function(){return this.o}},name:{configurable:!0,get:function(){return this.ta},set:function(a){this.ta=a}},isComplete:{configurable:!0,get:function(){return this.j},set:function(a){this.j=a}}});we.prototype.optimize=we.prototype.Zs;we.prototype.redo=we.prototype.redo;we.prototype.canRedo=we.prototype.canRedo;we.prototype.undo=we.prototype.undo;we.prototype.canUndo=we.prototype.canUndo;
we.prototype.clear=we.prototype.clear;we.className="Transaction";function xe(){this.du=new I;this.Cd=!1;this.F=(new H).freeze();this.Ce=-1;this.o=999;this.Ee=!1;this.dr=null;this.Ii=0;this.j=!1;G&&(this.j=!0);this.Ke=(new H).freeze();this.Dl=new H;this.St=!0;this.Vt=this.yr=this.Yt=this.Xt=!1}
xe.prototype.toString=function(a){var b="UndoManager "+this.historyIndex+"<"+this.history.count+"<="+this.maxHistoryLength;b+="[";for(var c=this.nestedTransactionNames.count,d=0;d<c;d++)0<d&&(b+=" "),b+=this.nestedTransactionNames.M(d);b+="]";if(void 0!==a&&0<a)for(c=this.history.count,d=0;d<c;d++)b+="\n "+this.history.M(d).toString(a-1);return b};
xe.prototype.clear=function(){var a=this.history;a.ka();for(var b=a.count-1;0<=b;b--){var c=a.M(b);null!==c&&c.clear()}a.clear();this.Ce=-1;a.freeze();this.Ee=!1;this.dr=null;this.Ii=0;this.Ke.ka();this.Ke.clear();this.Ke.freeze();this.Dl.clear();this.Vt=this.yr=this.Yt=this.Xt=!1};xe.prototype.copyProperties=function(a){this.isEnabled=a.isEnabled;this.maxHistoryLength=a.maxHistoryLength;this.checksTransactionLevel=a.checksTransactionLevel};t=xe.prototype;t.Jx=function(a){this.du.add(a)};t.Gy=function(a){this.du.remove(a)};
t.Ea=function(a){void 0===a&&(a="");null===a&&(a="");if(this.isUndoingRedoing)return!1;!0===this.St&&(this.St=!1,this.Ii++,this.isInternalTransaction||this.Ib("StartingFirstTransaction",a,this.currentTransaction),0<this.Ii&&this.Ii--);this.isEnabled&&(this.Ke.ka(),this.Ke.add(a),this.Ke.freeze(),null===this.currentTransaction?this.Dl.add(0):this.Dl.add(this.currentTransaction.changes.count));this.Ii++;var b=1===this.transactionLevel;b&&(this.isInternalTransaction||this.Ib("StartedTransaction",a,this.currentTransaction));
return b};t.cb=function(a){void 0===a&&(a="");return ye(this,!0,a)};t.Tf=function(){return ye(this,!1,"")};
function ye(a,b,c){if(a.isUndoingRedoing)return!1;a.checksTransactionLevel&&1>a.transactionLevel&&Fa("Ending transaction without having started a transaction: "+c);var d=1===a.transactionLevel,e=a.currentTransaction;d&&b&&(a.isInternalTransaction||a.Ib("CommittingTransaction",c,e));var f=0;if(0<a.transactionLevel&&(a.Ii--,a.isEnabled)){var g=a.Ke.count;0<g&&(""===c&&(c=a.Ke.M(0)),a.Ke.ka(),a.Ke.kb(g-1),a.Ke.freeze());g=a.Dl.count;0<g&&(f=a.Dl.M(g-1),a.Dl.kb(g-1))}if(d){if(b){a.yr=!1;null===e&&""!==
c&&(e=a.currentTransaction);if(a.isEnabled&&null!==e){e.isComplete||(e.isComplete=!0,e.name=c);b=a.history;b.ka();for(d=b.count-1;d>a.historyIndex;d--)f=b.M(d),null!==f&&f.clear(),b.kb(d),a.yr=!0;d=a.maxHistoryLength;0<=d&&(0===d?b.clear():b.count>=d&&(f=b.M(0),null!==f&&f.clear(),b.kb(0),a.Ce--));0===d||0!==b.count&&b.get(b.count-1)===e||(b.add(e),a.Ce++);b.freeze()}a.isInternalTransaction||a.Ib("CommittedTransaction",c,e)}else{a.Ee=!0;try{a.isEnabled&&null!==e&&(e.isComplete=!0,e.undo())}finally{a.isInternalTransaction||
a.Ib("RolledBackTransaction",c,e),a.Ee=!1}null!==e&&e.clear()}a.dr=null;a.isPendingClear&&a.clear();a.isPendingClear=!1;a.isPendingUnmodified=!1;return!0}if(a.isEnabled&&!b&&null!==e){a=f;c=e.changes;for(e=c.count-1;e>=a;e--)b=c.M(e),null!==b&&b.undo(),c.ka(),c.kb(e);c.freeze()}return!1}xe.prototype.canUndo=function(){if(!this.isEnabled||0<this.transactionLevel)return!1;var a=this.transactionToUndo;return null!==a&&a.canUndo()?!0:!1};
xe.prototype.undo=function(){if(this.canUndo()){var a=this.transactionToUndo;try{this.Ee=!0,this.Ib("StartingUndo","Undo",a),this.Ce--,a.undo()}catch(b){Fa("undo error: "+b.toString())}finally{this.Ib("FinishedUndo","Undo",a),this.Ee=!1}}};xe.prototype.canRedo=function(){if(!this.isEnabled||0<this.transactionLevel)return!1;var a=this.transactionToRedo;return null!==a&&a.canRedo()?!0:!1};
xe.prototype.redo=function(){if(this.canRedo()){var a=this.transactionToRedo;try{this.Ee=!0,this.Ib("StartingRedo","Redo",a),this.Ce++,a.redo()}catch(b){Fa("redo error: "+b.toString())}finally{this.Ib("FinishedRedo","Redo",a),this.Ee=!1}}};xe.prototype.Ib=function(a,b,c){void 0===c&&(c=null);var d=new re;d.change=te;d.propertyName=a;d.object=c;d.oldValue=b;for(a=this.models;a.next();)b=a.value,d.model=b,b.ws(d)};
xe.prototype.mv=function(a){if(this.isEnabled&&!this.isUndoingRedoing&&!this.skipsEvent(a)){var b=this.currentTransaction;null===b&&(this.dr=b=new we);var c=a.copy();b=b.changes;b.ka();b.add(c);b.freeze();this.checksTransactionLevel&&0>=this.transactionLevel&&!this.St&&(a=a.diagram,null!==a&&!1===a.$i||Fa("Change not within a transaction: "+c.toString()))}};
xe.prototype.skipsEvent=function(a){if(null===a||0>a.change.value)return!0;a=a.object;if(null===a)return!1;if(void 0!==a.layer){if(a=a.layer,null!==a&&a.isTemporary)return!0}else if(a.isTemporary)return!0;return!1};
na.Object.defineProperties(xe.prototype,{models:{configurable:!0,get:function(){return this.du.iterator}},isEnabled:{configurable:!0,get:function(){return this.Cd},set:function(a){this.Cd=a}},transactionToUndo:{configurable:!0,get:function(){return 0<=this.historyIndex&&this.historyIndex<=this.history.count-1?this.history.M(this.historyIndex):null}},transactionToRedo:{configurable:!0,get:function(){return this.historyIndex<this.history.count-
1?this.history.M(this.historyIndex+1):null}},isUndoingRedoing:{configurable:!0,get:function(){return this.Ee}},history:{configurable:!0,get:function(){return this.F}},maxHistoryLength:{configurable:!0,get:function(){return this.o},set:function(a){this.o=a}},historyIndex:{configurable:!0,get:function(){return this.Ce}},currentTransaction:{configurable:!0,get:function(){return this.dr}},transactionLevel:{configurable:!0,
get:function(){return this.Ii}},isInTransaction:{configurable:!0,get:function(){return 0<this.Ii}},checksTransactionLevel:{configurable:!0,get:function(){return this.j},set:function(a){this.j=a}},nestedTransactionNames:{configurable:!0,get:function(){return this.Ke}},isPendingClear:{configurable:!0,get:function(){return this.Xt},set:function(a){this.Xt=a}},isPendingUnmodified:{configurable:!0,get:function(){return this.Yt},set:function(a){this.Yt=
a}},isInternalTransaction:{configurable:!0,get:function(){return this.Vt},set:function(a){this.Vt=a}},isJustDiscarded:{configurable:!0,get:function(){return this.yr}}});xe.prototype.handleChanged=xe.prototype.mv;xe.prototype.redo=xe.prototype.redo;xe.prototype.undo=xe.prototype.undo;xe.prototype.canUndo=xe.prototype.canUndo;xe.prototype.rollbackTransaction=xe.prototype.Tf;xe.prototype.commitTransaction=xe.prototype.cb;xe.prototype.startTransaction=xe.prototype.Ea;
xe.prototype.removeModel=xe.prototype.Gy;xe.prototype.addModel=xe.prototype.Jx;xe.prototype.clear=xe.prototype.clear;xe.className="UndoManager";function ze(){0<arguments.length&&Ca(ze);ab(this);this.D=Ge;this.ta="";this.Cd=!0;this.Vb=!1;this.Ek=null;this.lz=new oe;this.ts=-1}ze.prototype.toString=function(){return""!==this.name?this.name+" Tool":Qa(this.constructor)};ze.prototype.updateAdornments=function(){};ze.prototype.canStart=function(){return this.isEnabled};ze.prototype.doStart=function(){};
ze.prototype.doActivate=function(){this.isActive=!0};ze.prototype.doDeactivate=function(){this.isActive=!1};ze.prototype.doStop=function(){};ze.prototype.doCancel=function(){this.transactionResult=null;this.stopTool()};ze.prototype.stopTool=function(){var a=this.diagram;a.currentTool===this&&(a.currentTool=null,a.currentCursor="")};ze.prototype.doMouseDown=function(){!this.isActive&&this.canStart()&&this.doActivate()};ze.prototype.doMouseMove=function(){};ze.prototype.doMouseUp=function(){this.stopTool()};
ze.prototype.doMouseWheel=function(){};ze.prototype.canStartMultiTouch=function(){return!0};ze.prototype.standardPinchZoomStart=function(){var a=this.diagram,b=a.lastInput,c=b.mq(0,K.allocAt(NaN,NaN)),d=b.mq(1,K.allocAt(NaN,NaN));if(c.s()&&d.s()&&(this.doCancel(),a.om("hasGestureZoom"))){a.nx=a.scale;var e=d.x-c.x,f=d.y-c.y;a.vx=Math.sqrt(e*e+f*f);b.bubbles=!1}K.free(c);K.free(d)};
ze.prototype.standardPinchZoomMove=function(){var a=this.diagram,b=a.lastInput,c=b.mq(0,K.allocAt(NaN,NaN)),d=b.mq(1,K.allocAt(NaN,NaN));if(c.s()&&d.s()&&(this.doCancel(),a.om("hasGestureZoom"))){var e=d.x-c.x,f=d.y-c.y;f=Math.sqrt(e*e+f*f)/a.vx;e=new K((Math.min(d.x,c.x)+Math.max(d.x,c.x))/2,(Math.min(d.y,c.y)+Math.max(d.y,c.y))/2);f*=a.nx;var g=a.commandHandler;if(f!==a.scale&&g.canResetZoom(f)){var h=a.zoomPoint;a.zoomPoint=e;g.resetZoom(f);a.zoomPoint=h}b.bubbles=!1}K.free(c);K.free(d)};
ze.prototype.doKeyDown=function(){"Esc"===this.diagram.lastInput.key&&this.doCancel()};ze.prototype.doKeyUp=function(){};ze.prototype.Ea=function(a){void 0===a&&(a=this.name);this.transactionResult=null;return this.diagram.Ea(a)};ze.prototype.stopTransaction=function(){var a=this.diagram;return null===this.transactionResult?a.Tf():a.cb(this.transactionResult)};
ze.prototype.standardMouseSelect=function(){var a=this.diagram;if(a.allowSelect){var b=a.lastInput,c=a.mm(b.documentPoint,!1);if(null!==c)if($a?b.meta:b.control){a.V("ChangingSelection",a.selection);for(b=c;null!==b&&!b.canSelect();)b=b.containingGroup;null!==b&&(b.isSelected=!b.isSelected);a.V("ChangedSelection",a.selection)}else if(b.shift){if(!c.isSelected){a.V("ChangingSelection",a.selection);for(b=c;null!==b&&!b.canSelect();)b=b.containingGroup;null!==b&&(b.isSelected=!0);a.V("ChangedSelection",
a.selection)}}else{if(!c.isSelected){for(b=c;null!==b&&!b.canSelect();)b=b.containingGroup;null!==b&&a.select(b)}}else!b.left||($a?b.meta:b.control)||b.shift||a.clearSelection()}};ze.prototype.standardMouseClick=function(a,b){void 0===a&&(a=null);void 0===b&&(b=function(a){return!a.layer.isTemporary});var c=this.diagram,d=c.lastInput;a=c.dc(d.documentPoint,a,b);d.targetObject=a;He(a,d,c);return d.handled};
function He(a,b,c){b.handled=!1;if(null===a||a.Qf()){var d=0;b.left?d=1===b.clickCount?1:2===b.clickCount?2:1:b.right&&1===b.clickCount&&(d=3);var e="ObjectSingleClicked";if(null!==a){switch(d){case 1:e="ObjectSingleClicked";break;case 2:e="ObjectDoubleClicked";break;case 3:e="ObjectContextClicked"}0!==d&&c.V(e,a)}else{switch(d){case 1:e="BackgroundSingleClicked";break;case 2:e="BackgroundDoubleClicked";break;case 3:e="BackgroundContextClicked"}0!==d&&c.V(e)}if(null!==a)for(;null!==a;){c=null;switch(d){case 1:c=
a.click;break;case 2:c=a.doubleClick?a.doubleClick:a.click;break;case 3:c=a.contextClick}if(null!==c&&(c(b,a),b.handled))break;a=a.panel}else{a=null;switch(d){case 1:a=c.click;break;case 2:a=c.doubleClick?c.doubleClick:c.click;break;case 3:a=c.contextClick}null!==a&&a(b)}}}
ze.prototype.standardMouseOver=function(){var a=this.diagram,b=a.lastInput;if(!0!==a.animationManager.yb){var c=a.skipsUndoManager;a.skipsUndoManager=!0;var d=a.viewportBounds.ca(b.documentPoint)?a.dc(b.documentPoint,null,null):null;b.targetObject=d;var e=!1;if(d!==a.Vk){var f=a.Vk,g=f;a.Vk=d;this.doCurrentObjectChanged(f,d);for(b.handled=!1;null!==f;){var h=f.mouseLeave;if(null!==h){if(d===f)break;if(null!==d&&d.Dg(f))break;h(b,f,d);e=!0;if(b.handled)break}f=f.panel}f=g;for(b.handled=!1;null!==d;){g=
d.mouseEnter;if(null!==g){if(f===d)break;if(null!==f&&f.Dg(d))break;g(b,d,f);e=!0;if(b.handled)break}d=d.panel}d=a.Vk}if(null!==d){f=d;for(g="";null!==f;){g=f.cursor;if(""!==g)break;f=f.panel}a.currentCursor=g;b.handled=!1;for(f=d;null!==f;){d=f.mouseOver;if(null!==d&&(d(b,f),e=!0,b.handled))break;f=f.panel}}else a.currentCursor="",d=a.mouseOver,null!==d&&(d(b),e=!0);e&&a.Lb();a.skipsUndoManager=c}};ze.prototype.doCurrentObjectChanged=function(){};
ze.prototype.standardMouseWheel=function(){var a=this.diagram,b=a.lastInput,c=b.delta;if(0!==c&&a.documentBounds.s()){var d=a.commandHandler,e=a.toolManager.mouseWheelBehavior;if(null!==d&&(e===Ie&&!b.shift||e===Je&&b.control)){if(0<c?d.canIncreaseZoom():d.canDecreaseZoom())e=a.zoomPoint,a.zoomPoint=b.viewPoint,0<c?d.increaseZoom():d.decreaseZoom(),a.zoomPoint=e;b.bubbles=!1}else if(e===Ie&&b.shift||e===Je&&!b.control){d=a.position.copy();var f=0<c?c:-c,g=b.event,h=g.deltaMode;e=g.deltaX;g=g.deltaY;
if(Xa||Za)h=1,0<e&&(e=3),0>e&&(e=-3),0<g&&(g=3),0>g&&(g=-3);if(void 0===h||void 0===e||void 0===g||0===e&&0===g||b.shift)!b.shift&&a.allowVerticalScroll?(f=3*f*a.scrollVerticalLineChange,0<c?a.scroll("pixel","up",f):a.scroll("pixel","down",f)):b.shift&&a.allowHorizontalScroll&&(f=3*f*a.scrollHorizontalLineChange,0<c?a.scroll("pixel","left",f):a.scroll("pixel","right",f));else{switch(h){case 0:c="pixel";break;case 1:c="line";break;case 2:c="page";break;default:c="pixel"}0!==e&&a.allowHorizontalScroll&&
(e*=a.scrollHorizontalLineChange/16,0<e?a.scroll(c,"left",-e):a.scroll(c,"right",e));0!==g&&a.allowVerticalScroll&&(g*=a.scrollVerticalLineChange/16,0<g?a.scroll(c,"up",-g):a.scroll(c,"down",g))}a.position.B(d)||(b.bubbles=!1)}}};ze.prototype.standardWaitAfter=function(a,b){G&&A(a,"number",ze,"standardWaitAfter:delay");void 0===b&&(b=this.diagram.lastInput);this.cancelWaitAfter();var c=this,d=b.clone(this.lz);this.ts=va(function(){c.doWaitAfter(d)},a)};
ze.prototype.cancelWaitAfter=function(){-1!==this.ts&&sa.clearTimeout(this.ts);this.ts=-1};ze.prototype.doWaitAfter=function(){};ze.prototype.findToolHandleAt=function(a,b){a=this.diagram.dc(a,function(a){for(;null!==a&&!(a.panel instanceof Ke);)a=a.panel;return a});return null===a?null:a.part.category===b?a:null};
ze.prototype.isBeyondDragSize=function(a,b){var c=this.diagram;void 0===a&&(a=c.firstInput.viewPoint);void 0===b&&(b=c.lastInput.viewPoint);var d=c.toolManager.dragSize,e=d.width;d=d.height;c.firstInput.isTouchEvent&&(e+=6,d+=6);return Math.abs(b.x-a.x)>e||Math.abs(b.y-a.y)>d};
na.Object.defineProperties(ze.prototype,{diagram:{configurable:!0,get:function(){return this.D},set:function(a){a instanceof Q&&(this.D=a)}},name:{configurable:!0,get:function(){return this.ta},set:function(a){A(a,"string",ze,"name");this.ta=a}},isEnabled:{configurable:!0,get:function(){return this.Cd},set:function(a){A(a,"boolean",ze,"isEnabled");this.Cd=a}},isActive:{configurable:!0,get:function(){return this.Vb},set:function(a){A(a,"boolean",
ze,"isActive");this.Vb=a}},transactionResult:{configurable:!0,get:function(){return this.Ek},set:function(a){null!==a&&A(a,"string",ze,"transactionResult");this.Ek=a}}});ze.prototype.startTransaction=ze.prototype.Ea;ze.className="Tool";function Va(){ze.call(this);this.name="ToolManager";this.Mb=new H;this.Wb=new H;this.xc=new H;this.O=this.Da=850;this.o=(new Hb(2,2)).ia();this.Ra=5E3;this.Ha=Je;this.F=Le;this.cr=this.j=null;this.Vj=-1}ma(Va,ze);Va.prototype.initializeStandardTools=function(){};
Va.prototype.updateAdornments=function(a){var b=this.currentToolTip;if(b instanceof Ke&&this.cr===a){var c=b.adornedObject;(null!==a?c.part===a:null===c)?this.showToolTip(b,c):this.hideToolTip()}};
Va.prototype.doMouseDown=function(){var a=this.diagram,b=a.lastInput;b.isTouchEvent&&this.gestureBehavior===Me&&(b.bubbles=!1);if(b.isMultiTouch){this.cancelWaitAfter();if(this.gestureBehavior===Ne){b.bubbles=!0;return}if(this.gestureBehavior===Me)return;if(a.currentTool.canStartMultiTouch()){a.currentTool.standardPinchZoomStart();return}}var c=a.undoManager;G&&c.checksTransactionLevel&&0!==c.transactionLevel&&Fa("WARNING: In ToolManager.doMouseDown: UndoManager.transactionLevel is not zero");c=this.mouseDownTools.length;
for(var d=0;d<c;d++){var e=this.mouseDownTools.M(d);e.diagram=this.diagram;if(e.canStart()){a.doFocus();a.currentTool=e;a.currentTool===e&&(e.isActive||e.doActivate(),e.doMouseDown());return}}1===a.lastInput.button&&(this.mouseWheelBehavior===Je?this.mouseWheelBehavior=Ie:this.mouseWheelBehavior===Ie&&(this.mouseWheelBehavior=Je));this.doActivate();this.standardWaitAfter(this.holdDelay,b)};
Va.prototype.doMouseMove=function(){var a=this.diagram,b=a.lastInput;if(b.isMultiTouch){if(this.gestureBehavior===Ne){b.bubbles=!0;return}if(this.gestureBehavior===Me)return;if(a.currentTool.canStartMultiTouch()){a.currentTool.standardPinchZoomMove();return}}if(this.isActive)for(var c=this.mouseMoveTools.length,d=0;d<c;d++){var e=this.mouseMoveTools.M(d);e.diagram=this.diagram;if(e.canStart()){a.doFocus();a.currentTool=e;a.currentTool===e&&(e.isActive||e.doActivate(),e.doMouseMove());return}}Oe(this,
a);a=b.event;null===a||"pointermove"!==a.type&&a.cancelable||(b.bubbles=!0)};function Oe(a,b){a.standardMouseOver();a.isBeyondDragSize()&&a.standardWaitAfter(a.isActive?a.holdDelay:a.hoverDelay,b.lastInput)}Va.prototype.doCurrentObjectChanged=function(a,b){a=this.currentToolTip;null===a||null!==b&&a instanceof Ke&&(b===a||b.Dg(a))||this.hideToolTip()};
Va.prototype.doWaitAfter=function(a){var b=this.diagram;b.Ia&&(this.doMouseHover(),this.isActive||this.doToolTip(),a.isTouchEvent&&!b.lastInput.handled&&(a=a.copy(),a.button=2,a.buttons=2,b.lastInput=a,b.wu=!0,b.doMouseUp()))};
Va.prototype.doMouseHover=function(){var a=this.diagram,b=a.lastInput;null===b.targetObject&&(b.targetObject=a.dc(b.documentPoint,null,null));var c=b.targetObject;if(null!==c)for(b.handled=!1;null!==c;){a=this.isActive?c.mouseHold:c.mouseHover;if(null!==a&&(a(b,c),b.handled))break;c=c.panel}else c=this.isActive?a.mouseHold:a.mouseHover,null!==c&&c(b)};
Va.prototype.doToolTip=function(){var a=this.diagram,b=a.lastInput;null===b.targetObject&&(b.targetObject=a.dc(b.documentPoint,null,null));b=b.targetObject;if(null!==b){if(a=this.currentToolTip,!(a instanceof Ke)||b!==a&&!b.Dg(a)){for(;null!==b;){a=b.toolTip;if(null!==a){this.showToolTip(a,b);return}b=b.panel}this.hideToolTip()}}else b=a.toolTip,null!==b?this.showToolTip(b,null):this.hideToolTip()};
Va.prototype.showToolTip=function(a,b){!G||a instanceof Ke||a instanceof Pe||v("showToolTip:tooltip must be an Adornment or HTMLInfo.");null!==b&&w(b,O,Va,"showToolTip:obj");var c=this.diagram;a!==this.currentToolTip&&this.hideToolTip();if(a instanceof Ke){a.layerName="Tool";a.selectable=!1;a.scale=1/c.scale;a.category="ToolTip";null!==a.placeholder&&(a.placeholder.scale=c.scale);var d=a.diagram;null!==d&&d!==c&&d.remove(a);c.add(a);null!==b?a.adornedObject=b:a.data=c.model;a.Ya();this.positionToolTip(a,
b)}else a instanceof Pe&&a!==this.currentToolTip&&a.show(b,c,this);this.currentToolTip=a;-1!==this.Vj&&(sa.clearTimeout(this.Vj),this.Vj=-1);a=this.toolTipDuration;if(0<a&&Infinity!==a){var e=this;this.Vj=va(function(){e.hideToolTip()},a)}};
Va.prototype.positionToolTip=function(a){if(null===a.placeholder){var b=this.diagram,c=b.lastInput.documentPoint.copy(),d=a.measuredBounds,e=b.viewportBounds;b.lastInput.isTouchEvent&&(c.x-=d.width);c.x+d.width>e.right&&(c.x-=d.width+5/b.scale);c.x<e.x&&(c.x=e.x);c.y=c.y+20/b.scale+d.height>e.bottom?c.y-(d.height+5/b.scale):c.y+20/b.scale;c.y<e.y&&(c.y=e.y);a.position=c}};
Va.prototype.hideToolTip=function(){-1!==this.Vj&&(sa.clearTimeout(this.Vj),this.Vj=-1);var a=this.diagram,b=this.currentToolTip;null!==b&&(b instanceof Ke?(a.remove(b),null!==this.cr&&this.cr.Sf(b.category),b.data=null,b.adornedObject=null):b instanceof Pe&&null!==b.hide&&b.hide(a,this),this.currentToolTip=null)};
Va.prototype.doMouseUp=function(){this.cancelWaitAfter();var a=this.diagram;if(this.isActive)for(var b=this.mouseUpTools.length,c=0;c<b;c++){var d=this.mouseUpTools.M(c);d.diagram=this.diagram;if(d.canStart()){a.doFocus();a.currentTool=d;a.currentTool===d&&(d.isActive||d.doActivate(),d.doMouseUp());return}}a.doFocus();this.doDeactivate()};Va.prototype.doMouseWheel=function(){this.standardMouseWheel()};Va.prototype.doKeyDown=function(){var a=this.diagram;null!==a.commandHandler&&a.commandHandler.doKeyDown()};
Va.prototype.doKeyUp=function(){var a=this.diagram;null!==a.commandHandler&&a.commandHandler.doKeyUp()};Va.prototype.findTool=function(a){A(a,"string",Va,"findTool:name");for(var b=this.mouseDownTools.length,c=0;c<b;c++){var d=this.mouseDownTools.M(c);if(d.name===a)return d}b=this.mouseMoveTools.length;for(c=0;c<b;c++)if(d=this.mouseMoveTools.M(c),d.name===a)return d;b=this.mouseUpTools.length;for(c=0;c<b;c++)if(d=this.mouseUpTools.M(c),d.name===a)return d;return null};
Va.prototype.replaceTool=function(a,b){A(a,"string",Va,"replaceTool:name");null!==b&&(w(b,ze,Va,"replaceTool:newtool"),b.diagram=this.diagram);for(var c=this.mouseDownTools.length,d=0;d<c;d++){var e=this.mouseDownTools.M(d);if(e.name===a)return null!==b?this.mouseDownTools.Vc(d,b):this.mouseDownTools.kb(d),e}c=this.mouseMoveTools.length;for(d=0;d<c;d++)if(e=this.mouseMoveTools.M(d),e.name===a)return null!==b?this.mouseMoveTools.Vc(d,b):this.mouseMoveTools.kb(d),e;c=this.mouseUpTools.length;for(d=
0;d<c;d++)if(e=this.mouseUpTools.M(d),e.name===a)return null!==b?this.mouseUpTools.Vc(d,b):this.mouseUpTools.kb(d),e;return null};Va.prototype.gb=function(a,b,c){A(a,"string",Va,"replaceStandardTool:name");w(c,H,Va,"replaceStandardTool:list");null!==b&&(w(b,ze,Va,"replaceStandardTool:newtool"),b.name=a,b.diagram=this.diagram);this.findTool(a)?this.replaceTool(a,b):null!==b&&c.add(b)};
na.Object.defineProperties(Va.prototype,{mouseWheelBehavior:{configurable:!0,get:function(){return this.Ha},set:function(a){db(a,Va,Va,"mouseWheelBehavior");this.Ha=a}},gestureBehavior:{configurable:!0,get:function(){return this.F},set:function(a){db(a,Va,Va,"gestureBehavior");this.F=a}},currentToolTip:{configurable:!0,get:function(){return this.j},set:function(a){!G||null===a||a instanceof Ke||a instanceof Pe||v("ToolManager.currentToolTip must be an Adornment or HTMLInfo.");
this.j=a;this.cr=null!==a&&a instanceof Ke?a.adornedPart:null}},mouseDownTools:{configurable:!0,get:function(){return this.Mb}},mouseMoveTools:{configurable:!0,get:function(){return this.Wb}},mouseUpTools:{configurable:!0,get:function(){return this.xc}},hoverDelay:{configurable:!0,get:function(){return this.Da},set:function(a){A(a,"number",Va,"hoverDelay");this.Da=a}},holdDelay:{configurable:!0,get:function(){return this.O},set:function(a){A(a,
"number",Va,"holdDelay");this.O=a}},dragSize:{configurable:!0,get:function(){return this.o},set:function(a){w(a,Hb,Va,"dragSize");this.o=a.L()}},toolTipDuration:{configurable:!0,get:function(){return this.Ra},set:function(a){A(a,"number",Va,"toolTipDuration");this.Ra=a}}});Va.prototype.replaceStandardTool=Va.prototype.gb;
var Je=new F(Va,"WheelScroll",0),Ie=new F(Va,"WheelZoom",1),Qe=new F(Va,"WheelNone",2),Le=new F(Va,"GestureZoom",3),Me=new F(Va,"GestureCancel",4),Ne=new F(Va,"GestureNone",5);Va.className="ToolManager";Va.WheelScroll=Je;Va.WheelZoom=Ie;Va.WheelNone=Qe;Va.GestureZoom=Le;Va.GestureCancel=Me;Va.GestureNone=Ne;
function Re(){ze.call(this);0<arguments.length&&Ca(Re);this.name="Dragging";this.F=this.Wb=!0;this.o=this.Ra=this.Da=this.og=null;this.En=this.xc=!1;this.Vl=new K(NaN,NaN);this.hs=new K;this.Mb=!0;this.al=100;this.Vg=[];this.te=(new I).freeze();this.Ha=new Se;this.ro=null;this.O="copy";this.Td="";this.Ud="no-drop"}ma(Re,ze);
Re.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(a.isReadOnly&&!a.allowDragOut||!a.allowMove&&!a.allowCopy&&!a.allowDragOut||!a.allowSelect)return!1;var b=a.lastInput;return!b.left||a.currentTool!==this&&(!this.isBeyondDragSize()||b.isTouchEvent&&b.timestamp-a.firstInput.timestamp<this.al)?!1:null!==this.findDraggablePart()};
Re.prototype.findDraggablePart=function(){var a=this.diagram;a=a.mm(a.firstInput.documentPoint,!1);if(null===a)return null;for(;null!==a&&!a.canSelect();)a=a.containingGroup;return null!==a&&(a.canMove()||a.canCopy())?a:null};
Re.prototype.standardMouseSelect=function(){var a=this.diagram;if(a.allowSelect){var b=a.mm(a.firstInput.documentPoint,!1);if(null!==b){for(;null!==b&&!b.canSelect();)b=b.containingGroup;this.currentPart=b;null===this.currentPart||this.currentPart.isSelected||(a.V("ChangingSelection",a.selection),b=a.lastInput,($a?b.meta:b.control)||b.shift||a.clearSelection(!0),this.currentPart.isSelected=!0,a.V("ChangedSelection",a.selection))}}};
Re.prototype.doActivate=function(){var a=this.diagram;this.ro=null;null===this.currentPart&&this.standardMouseSelect();var b=this.currentPart;null!==b&&(b.canMove()||b.canCopy())&&(a.Mu(!0),Te=null,this.isActive=!0,this.Vl.set(a.position),Ue(this,a.selection),this.Vg.length=0,a.animationManager.wc(),this.draggedParts=this.computeEffectiveCollection(a.selection,this.dragOptions),a.ht=!0,!0===a.Ve("temporaryPixelRatio")&&30<a.Mx&&$e(a),af(a,this.draggedParts),this.Ea("Drag"),this.startPoint=a.firstInput.documentPoint,
a.isMouseCaptured=!0,a.allowDragOut&&(this.isDragOutStarted=!0,this.En=!1,Te=this,bf=this.diagram,this.doSimulatedDragOut()))};function Ue(a,b){if(a.dragsLink){var c=a.diagram;c.allowRelink&&(c.model.nk()&&1===b.count&&b.first()instanceof R?(a.draggedLink=b.first(),a.draggedLink.canRelinkFrom()&&a.draggedLink.canRelinkTo()&&a.draggedLink.$j(),a.og=c.toolManager.findTool("Relinking"),null===a.og&&(a.og=new cf,a.og.diagram=c)):(a.draggedLink=null,a.og=null))}}
Re.prototype.computeEffectiveCollection=function(a,b){return this.diagram.commandHandler.computeEffectiveCollection(a,b)};Re.prototype.Hd=function(a){return void 0===a?new df(zb):this.isGridSnapEnabled?new df(new K(Math.round(1E3*a.x)/1E3,Math.round(1E3*a.y)/1E3)):new df(a.copy())};
Re.prototype.doDeactivate=function(){this.isActive=!1;var a=this.diagram;a.Mu(!1);a.Fg();ef(this);ff(a,this.draggedParts);this.draggedParts=this.currentPart=this.ro=null;this.En=this.isDragOutStarted=!1;if(0<gf.count){for(var b=gf,c=b.length,d=0;d<c;d++){var e=b.M(d);hf(e);jf(e);ef(e);e.diagram.Fg()}b.clear()}hf(this);this.Vl.h(NaN,NaN);null!==bf&&(bf.currentCursor="");Te=bf=null;jf(this);a.isMouseCaptured=!1;a.currentCursor="";a.ht=!1;this.stopTransaction();kf(a,!0)};
Re.prototype.stopTransaction=function(){var a=this.diagram,b=ze.prototype.stopTransaction.call(this);b&&null!==a.undoManager.transactionToUndo&&a.undoManager.transactionToUndo.Zs();return b};function ef(a){var b=a.diagram,c=b.skipsUndoManager;b.skipsUndoManager=!0;lf(a,b.lastInput,null);b.skipsUndoManager=c;a.Vg.length=0}function mf(){var a=Te;jf(a);nf(a);var b=a.diagram;a.Vl.s()&&(b.position=a.Vl);b.Fg()}
Re.prototype.doCancel=function(){jf(this);nf(this);var a=this.diagram;this.Vl.s()&&(a.position=this.Vl);this.stopTool()};Re.prototype.doKeyDown=function(){var a=this.diagram,b=a.lastInput;this.isActive&&("Esc"===b.key?this.doCancel():b.key!==a.previousInput.key&&this.doMouseMove())};Re.prototype.doKeyUp=function(){this.isActive&&this.doMouseMove()};
function of(a,b){if(null===a.copiedParts){var c=a.diagram;if((!b||!c.isReadOnly&&!c.isModelReadOnly)&&null!==a.draggedParts){var d=c.undoManager;d.isEnabled&&d.isInTransaction?null!==d.currentTransaction&&0<d.currentTransaction.changes.count&&(c.undoManager.Tf(),c.Ea("Drag")):nf(a);c.skipsUndoManager=!b;c.partManager.addsToTemporaryLayer=!b;a.startPoint=c.firstInput.documentPoint;b=a.copiesEffectiveCollection?a.draggedParts.Uf():c.selection;b=c.ek(b,c,!0);c=new yb;for(d=a.draggedParts.iterator;d.next();){var e=
d.key;if(e.Tc()&&e.canCopy()){var f=b.K(e);null!==f&&(f.location=e.location,f.Ya(),c.add(f,a.Hd(f.location)))}}for(b=b.iterator;b.next();)d=b.value,d instanceof R&&d.canCopy()&&c.add(d,a.Hd());a.copiedParts=c;Ue(a,c.Uf());null!==a.draggedLink&&(c=a.draggedLink,b=c.routeBounds,pf(c,a.startPoint.x-(b.x+b.width/2),a.startPoint.y-(b.y+b.height/2)));a.doUpdateCursor(null,!0)}}}
function jf(a){var b=a.diagram;if(null!==a.copiedParts){b.bt(a.copiedParts.Uf(),!1);a.copiedParts=null;if(null!==a.draggedParts)for(var c=a.draggedParts.iterator;c.next();)c.key instanceof R&&(c.value.point=new K(0,0));a.doUpdateCursor(null,!0)}b.skipsUndoManager=!1;b.partManager.addsToTemporaryLayer=!1;a.startPoint=b.firstInput.documentPoint}
function hf(a){if(null!==a.draggedLink){if(a.dragsLink&&null!==a.og){var b=a.og;b.diagram.remove(b.temporaryFromNode);b.diagram.remove(b.temporaryToNode)}a.draggedLink=null;a.og=null}}function uf(a,b,c){var d=a.diagram,e=a.startPoint,f=K.alloc();f.assign(d.lastInput.documentPoint);a.moveParts(b,f.qe(e),c);K.free(f);!0===d.Ve("temporaryPixelRatio")&&null===d.Di&&30<d.Mx&&($e(d),d.Bq())}
Re.prototype.moveParts=function(a,b,c){void 0===c&&(c=!1);var d=this.diagram;null!==d&&vf(d,a,b,this.dragOptions,c)};function nf(a){if(null!==a.draggedParts){for(var b=a.diagram,c=a.draggedParts.iterator;c.next();){var d=c.key;d.Tc()&&(d.location=c.value.point)}for(c=a.draggedParts.iterator;c.next();)if(d=c.key,d instanceof R&&d.suspendsRouting){var e=c.value.point;a.draggedParts.add(d,a.Hd());pf(d,-e.x,-e.y)}b.od()}}
function wf(a,b){var c=a.diagram;a.dragsLink&&(null!==a.draggedLink&&(a.draggedLink.fromNode=null,a.draggedLink.toNode=null),xf(a,!1));var d=a.findDragOverObject(b),e=c.lastInput;e.targetObject=d;a.doUpdateCursor(d,!1);var f=c.skipsUndoManager,g=!1;try{c.skipsUndoManager=!0;g=lf(a,e,d);if(!a.isActive&&null===Te)return;var h=null!==d?d.part:null;if(null===h||c.handlesDragDropForTopLevelParts&&h.isTopLevel&&!(h instanceof yf)){var k=c.mouseDragOver;null!==k&&(k(e),g=!0)}if(!a.isActive&&null===Te)return;
a.doDragOver(b,d);if(!a.isActive&&null===Te)return}finally{c.skipsUndoManager=f,g&&c.od()}a.ro=d;c.isReadOnly||!c.allowMove&&!c.allowCopy||!c.allowHorizontalScroll&&!c.allowVerticalScroll||c.zs(e.viewPoint)}Re.prototype.findDragOverObject=function(a){var b=this;return zf(this.diagram,a,null,function(a){null===a?a=!0:(a=a.part,a=null===a||a instanceof Ke||a.layer.isTemporary||b.draggedParts&&b.draggedParts.contains(a)||b.copiedParts&&b.copiedParts.contains(a)?!0:!1);return!a})};
Re.prototype.doUpdateCursor=function(a,b){var c=this.diagram;if(b||this.ro!==a)!this.diagram.currentTool.isActive||this.mayCopy()?c.currentCursor=this.copyCursor:this.mayMove()?c.currentCursor=this.moveCursor:this.mayDragOut()&&(c.currentCursor=this.nodropCursor)};
function lf(a,b,c){var d=!1,e=a.Vg.length,f=0<e?a.Vg[0]:null;if(c===f)return!1;b.handled=!1;for(var g=0;g<e;g++){var h=a.Vg[g],k=h.mouseDragLeave;if(null!==k&&(k(b,h,c),d=!0,b.handled))break}a.Vg.length=0;if(!a.isActive&&null===Te||null===c)return d;b.handled=!1;for(e=c;null!==e;)a.Vg.push(e),e=Af(e);e=a.Vg.length;for(c=0;c<e&&(g=a.Vg[c],h=g.mouseDragEnter,null===h||(h(b,g,f),d=!0,!b.handled));c++);return d}
function Af(a){var b=a.panel;return null!==b?b:a instanceof U&&!(a instanceof yf)&&(a=a.containingGroup,null!==a&&a.handlesDragDropForMembers)?a:null}function Bf(a,b,c){var d=a.og;if(null===d)return null;var e=a.diagram.Bg(b,d.portGravity,function(a){return d.findValidLinkablePort(a,c)});a=K.alloc();var f=Infinity,g=null;for(e=e.iterator;e.next();){var h=e.value;if(null!==h.part){var k=h.ja(Ic,a);k=b.Jf(k);k<f&&(g=h,f=k)}}K.free(a);return g}
function xf(a,b){var c=a.draggedLink;if(null!==c&&!(2>c.pointsCount)){var d=a.diagram;if(!d.isReadOnly){var e=a.og;if(null!==e){var f=null,g=null;null===c.fromNode&&(f=Bf(a,c.i(0),!1),null!==f&&(g=f.part));var h=null,k=null;null===c.toNode&&(h=Bf(a,c.i(c.pointsCount-1),!0),null!==h&&(k=h.part));e.isValidLink(g,f,k,h)?b?(c.defaultFromPoint=c.i(0),c.defaultToPoint=c.i(c.pointsCount-1),c.suspendsRouting=!1,c.fromNode=g,null!==f&&(c.fromPortId=f.portId),c.toNode=k,null!==h&&(c.toPortId=h.portId),c.fromPort!==
d.By&&d.V("LinkRelinked",c,d.By),c.toPort!==d.Cy&&d.V("LinkRelinked",c,d.Cy)):Cf(e,g,f,k,h):Cf(e,null,null,null,null)}}}}Re.prototype.doDragOver=function(){};
function Df(a,b){var c=a.diagram;a.dragsLink&&xf(a,!0);ef(a);var d=a.findDragOverObject(b),e=c.lastInput;e.targetObject=d;if(null!==d){e.handled=!1;for(var f=d;null!==f;){var g=f.mouseDrop;if(null!==g&&(g(e,f),e.handled))break;Ef(a,e,f);f=Af(f)}}else f=c.mouseDrop,null!==f&&f(e);if(a.isActive||null!==Te){for(e=(a.copiedParts||a.draggedParts).iterator;e.next();)f=e.key,f instanceof V&&f.linksConnected.each(function(a){a.suspendsRouting=!1});a.doDropOnto(b,d);if(a.isActive||null!==Te){a=M.alloc();for(b=
c.selection.iterator;b.next();)d=b.value,d instanceof V&&Ff(c,d,a);M.free(a)}}}function Ef(a,b,c){a=a.diagram;c=c.part;!a.handlesDragDropForTopLevelParts||!c.isTopLevel||c instanceof yf||(c=a.mouseDrop,null!==c&&c(b))}function Ff(a,b,c){var d=!1;b.getAvoidableRect(c);a.viewportBounds.Te(c)&&(d=!0);a=a.ev(c,function(a){return a.part},function(a){return a instanceof R},!0,function(a){return a instanceof R},d);if(0!==a.count)for(a=a.iterator;a.next();)c=a.value,!c.Pd(b)&&c.isAvoiding&&c.$a()}
Re.prototype.doDropOnto=function(){};Re.prototype.doMouseMove=function(){if(this.isActive){var a=this.diagram,b=a.lastInput;this.simulatedMouseMove(b.event,b.documentPoint,b.targetDiagram)||null===this.currentPart||null===this.draggedParts||(this.mayCopy()?(of(this,!1),af(a,this.copiedParts),uf(this,this.copiedParts,!1),ff(a,this.copiedParts)):this.mayMove()?(jf(this),uf(this,this.draggedParts,!0)):this.mayDragOut()?(of(this,!1),uf(this,this.copiedParts,!1)):jf(this),wf(this,a.lastInput.documentPoint))}};
Re.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram,b=a.lastInput;if(!this.simulatedMouseUp(b.event,b.documentPoint,b.targetDiagram)){b=!1;var c=this.mayCopy();c&&null!==this.copiedParts?(jf(this),of(this,!0),af(a,this.copiedParts),uf(this,this.copiedParts,!1),ff(a,this.copiedParts),null!==this.copiedParts&&(a.V("ChangingSelection",a.selection),a.clearSelection(!0),this.copiedParts.iteratorKeys.each(function(a){a.isSelected=!0}))):(b=!0,jf(this),this.mayMove()&&(uf(this,this.draggedParts,
!0),wf(this,a.lastInput.documentPoint)));this.En=!0;Df(this,a.lastInput.documentPoint);if(this.isActive){var d=c?this.copiedParts.Uf():this.draggedParts.Uf();this.copiedParts=null;b&&Gf(this);a.Wa();ff(a,this.draggedParts);this.transactionResult=c?"Copy":"Move";a.V(c?"SelectionCopied":"SelectionMoved",d)}this.stopTool();c&&a.V("ChangedSelection",a.selection)}}};
Re.prototype.simulatedMouseMove=function(a,b,c){if(null===Te)return!1;var d=Te.diagram;c instanceof Q||(c=null);var e=bf;c!==e&&(null!==e&&e!==d&&(e.Fg(),Te.isDragOutStarted=!1,e=e.toolManager.findTool("Dragging"),null!==e&&e.doSimulatedDragLeave()),bf=c,null!==c&&c!==d&&(mf(),e=c.toolManager.findTool("Dragging"),null!==e&&(gf.contains(e)||gf.add(e),e.doSimulatedDragEnter())),this.doUpdateCursor(null,!0));if(null===c||c===d||!c.allowDrop||c.isReadOnly||!c.allowInsert)return!1;d=c.toolManager.findTool("Dragging");
null!==d&&(null!==a&&(void 0!==a.targetTouches&&(0<a.targetTouches.length?a=a.targetTouches[0]:0<a.changedTouches.length&&(a=a.changedTouches[0])),b=c.getMouse(a)),c.lastInput.documentPoint=b,c.lastInput.viewPoint=c.Jq(b),c.lastInput.down=!1,c.lastInput.up=!1,d.doSimulatedDragOver());return!0};
Re.prototype.simulatedMouseUp=function(a,b,c){if(null===Te)return!1;var d=bf,e=Te.diagram;if(null===c)return Te.doCancel(),!0;if(c!==d){var f=d.toolManager.findTool("Dragging");if(null!==d&&d!==e&&null!==f)return d.Fg(),Te.isDragOutStarted=!1,f.doSimulatedDragLeave(),!1;bf=c;d=c.toolManager.findTool("Dragging");null!==d&&(mf(),gf.contains(d)||gf.add(d),d.doSimulatedDragEnter())}return c!==this.diagram?(null!==a?(void 0!==a.targetTouches&&(0<a.targetTouches.length?a=a.targetTouches[0]:0<a.changedTouches.length&&
(a=a.changedTouches[0])),b=c.getMouse(a)):null===b&&(b=new K),c.lastInput.documentPoint=b,c.lastInput.viewPoint=c.Jq(b),c.lastInput.down=!1,c.lastInput.up=!0,a=c.toolManager.findTool("Dragging"),null!==a&&a.doSimulatedDrop(),a=Te,null!==a&&(c=a.mayCopy(),a.transactionResult=c?"Copy":"Move",a.stopTool()),!0):!1};
function Gf(a){if(null!==a.draggedParts)for(var b=a.draggedParts.iterator;b.next();){var c=b.key;c instanceof V&&(c=c.containingGroup,null===c||null===c.placeholder||a.draggedParts.contains(c)||c.placeholder.v())}}
Re.prototype.mayCopy=function(){if(!this.isCopyEnabled)return!1;var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.allowCopy||($a?!a.lastInput.alt:!a.lastInput.control))return!1;for(a=a.selection.iterator;a.next();)if(a.value.canCopy())return!0;return null!==this.draggedLink&&this.dragsLink&&this.draggedLink.canCopy()?!0:!1};
Re.prototype.mayDragOut=function(){if(!this.isCopyEnabled)return!1;var a=this.diagram;if(!a.allowDragOut||!a.allowCopy||a.allowMove)return!1;for(a=a.selection.iterator;a.next();)if(a.value.canCopy())return!0;return null!==this.draggedLink&&this.dragsLink&&this.draggedLink.canCopy()?!0:!1};
Re.prototype.mayMove=function(){var a=this.diagram;if(a.isReadOnly||!a.allowMove)return!1;for(a=a.selection.iterator;a.next();)if(a.value.canMove())return!0;return null!==this.draggedLink&&this.dragsLink&&this.draggedLink.canMove()?!0:!1};Re.prototype.computeBorder=function(a,b,c){return this.En||null===this.draggedParts||this.draggedParts.contains(a)?null:c.assign(b)};Re.prototype.qA=function(){return Te};
Re.prototype.mayDragIn=function(){var a=this.diagram;if(!a.allowDrop||a.isReadOnly||a.isModelReadOnly||!a.allowInsert)return!1;var b=Te;return null===b||b.diagram.model.dataFormat!==a.model.dataFormat?!1:!0};Re.prototype.doSimulatedDragEnter=function(){if(this.mayDragIn()){var a=this.diagram;a.animationManager.wc();Hf(a);a.animationManager.wc();a=Te;null!==a&&(a.diagram.ht=!1);this.doUpdateCursor(null,!0)}};Re.prototype.doSimulatedDragLeave=function(){var a=Te;null!==a&&a.doSimulatedDragOut();this.doCancel()};
Re.prototype.doSimulatedDragOver=function(){var a=this.diagram;a.animationManager.fn=!0;var b=Te;if(null!==b&&null!==b.draggedParts){if(!this.mayDragIn())return;If(this,b.draggedParts.Uf(),!1,a.firstInput);uf(this,this.copiedParts,!1);wf(this,a.lastInput.documentPoint)}a.animationManager.fn=!1};
Re.prototype.doSimulatedDrop=function(){var a=this.diagram,b=Te;if(null!==b){var c=b.diagram;b.En=!0;jf(this);if(!this.mayDragIn())return;a.animationManager.fn=!0;a.V("ChangingSelection",a.selection);this.Ea("Drop");If(this,b.draggedParts.Uf(),!0,a.lastInput);uf(this,this.copiedParts,!1);null!==this.copiedParts&&(a.clearSelection(!0),this.copiedParts.iteratorKeys.each(function(a){a.isSelected=!0}));Df(this,a.lastInput.documentPoint);a.Wa();b=a.selection;null!==this.copiedParts?this.transactionResult=
"ExternalCopy":b=new I;this.copiedParts=null;a.doFocus();a.V("ExternalObjectsDropped",b,c);this.stopTransaction();a.V("ChangedSelection",a.selection)}a.animationManager.fn=!1};
function If(a,b,c,d){if(null===a.copiedParts){var e=a.diagram;if(!e.isReadOnly&&!e.isModelReadOnly){e.skipsUndoManager=!c;e.partManager.addsToTemporaryLayer=!c;a.startPoint=d.documentPoint;c=e.ek(b,e,!0);var f=M.alloc();e=d=Infinity;for(var g=-Infinity,h=-Infinity,k=b.iterator;k.next();){var l=k.value;if(l.isVisible()){var m=l.location;l=m.x;m=m.y;isNaN(l)||isNaN(m)||(l<d&&(d=l),m<e&&(e=m),l>g&&(g=l),m>h&&(h=m))}}Infinity===d?f.h(0,0,0,0):f.h(d,e,g-d,h-e);d=f.x+f.width/2;e=f.y+f.height/2;M.free(f);
f=a.hs;g=new yb;h=K.alloc();for(k=b.iterator;k.next();)l=k.value,l instanceof R&&l.canCopy()&&(m=c.K(l),null!==m&&(m.points=l.points,pf(m,f.x-d,f.y-e),m.suspendsRouting=!0,g.add(m,a.Hd())));for(b=b.iterator;b.next();)l=b.value,l.Tc()&&l.canCopy()&&(k=c.K(l),null!==k&&(l=l.location,h.h(f.x-(d-l.x),f.y-(e-l.y)),k.location=h,k.Ya(),g.add(k,a.Hd(h))));K.free(h);a.copiedParts=g;Ue(a,g.Uf());null!==a.draggedLink&&(c=a.draggedLink,b=c.routeBounds,pf(c,a.startPoint.x-(b.x+b.width/2),a.startPoint.y-(b.y+b.height/
2)));a.doUpdateCursor(null,!0)}}}Re.prototype.doSimulatedDragOut=function(){var a=this.diagram;a.ht=!1;this.mayCopy()||this.mayMove()?a.currentCursor="":a.currentCursor=this.nodropCursor;this.ro=null};Re.prototype.computeMove=function(a,b,c,d){c=this.diagram;return null!==c?c.computeMove(a,b,this.dragOptions,d):new K};
na.Object.defineProperties(Re.prototype,{isCopyEnabled:{configurable:!0,get:function(){return this.Wb},set:function(a){A(a,"boolean",Re,"isCopyEnabled");this.Wb=a}},copiesEffectiveCollection:{configurable:!0,get:function(){return this.F},set:function(a){A(a,"boolean",Re,"copiesEffectiveCollection");this.F=a}},dragOptions:{configurable:!0,get:function(){return this.Ha},set:function(a){w(a,Se,Re,"dragOptions");this.Ha=a}},isGridSnapEnabled:{configurable:!0,
enumerable:!0,get:function(){return this.dragOptions.isGridSnapEnabled},set:function(a){A(a,"boolean",Re,"isGridSnapEnabled");this.dragOptions.isGridSnapEnabled=a}},isComplexRoutingRealtime:{configurable:!0,get:function(){return this.Mb},set:function(a){A(a,"boolean",Re,"isComplexRoutingRealtime");this.Mb=a}},isGridSnapRealtime:{configurable:!0,get:function(){return this.dragOptions.isGridSnapRealtime},set:function(a){A(a,"boolean",Re,"isGridSnapRealtime");this.dragOptions.isGridSnapRealtime=
a}},gridSnapCellSize:{configurable:!0,get:function(){return this.dragOptions.gridSnapCellSize},set:function(a){w(a,Hb,Re,"gridSnapCellSize");this.dragOptions.gridSnapCellSize.B(a)||(a=a.L(),this.dragOptions.gridSnapCellSize=a)}},gridSnapCellSpot:{configurable:!0,get:function(){return this.dragOptions.gridSnapCellSpot},set:function(a){w(a,Ib,Re,"gridSnapCellSpot");this.dragOptions.gridSnapCellSpot.B(a)||(a=a.L(),this.dragOptions.gridSnapCellSpot=a)}},gridSnapOrigin:{configurable:!0,
enumerable:!0,get:function(){return this.dragOptions.gridSnapOrigin},set:function(a){w(a,K,Re,"gridSnapOrigin");this.dragOptions.gridSnapOrigin.B(a)||(a=a.L(),this.dragOptions.gridSnapOrigin=a)}},dragsLink:{configurable:!0,get:function(){return this.dragOptions.dragsLink},set:function(a){A(a,"boolean",Re,"dragsLink");this.dragOptions.dragsLink=a}},dragsTree:{configurable:!0,get:function(){return this.dragOptions.dragsTree},set:function(a){A(a,"boolean",Re,"dragsTree");
this.dragOptions.dragsTree=a}},copyCursor:{configurable:!0,get:function(){return this.O},set:function(a){this.O=a}},moveCursor:{configurable:!0,get:function(){return this.Td},set:function(a){this.Td=a}},nodropCursor:{configurable:!0,get:function(){return this.Ud},set:function(a){this.Ud=a}},currentPart:{configurable:!0,get:function(){return this.Da},set:function(a){null!==a&&w(a,U,Re,"currentPart");this.Da=a}},copiedParts:{configurable:!0,
get:function(){return this.o},set:function(a){this.o=a}},draggedParts:{configurable:!0,get:function(){return this.Ra},set:function(a){this.Ra=a}},draggingParts:{configurable:!0,get:function(){return null!==this.copiedParts?this.copiedParts.Uf():null!==this.draggedParts?this.draggedParts.Uf():this.te}},draggedLink:{configurable:!0,get:function(){return this.diagram.draggedLink},set:function(a){null!==a&&w(a,R,Re,"draggedLink");this.diagram.draggedLink=a}},
isDragOutStarted:{configurable:!0,get:function(){return this.xc},set:function(a){this.xc=a}},startPoint:{configurable:!0,get:function(){return this.hs},set:function(a){w(a,K,Re,"startPoint");this.hs.B(a)||this.hs.assign(a)}},delay:{configurable:!0,get:function(){return this.al},set:function(a){A(a,"number",Re,"delay");this.al=a}}});Re.prototype.getDraggingSource=Re.prototype.qA;var gf=null,Te=null,bf=null;Re.className="DraggingTool";gf=new H;
Ua("draggingTool",function(){return this.findTool("Dragging")},function(a){this.gb("Dragging",a,this.mouseMoveTools)});Va.prototype.doCancel=function(){null!==Te&&Te.doCancel();ze.prototype.doCancel.call(this)};
function Jf(){0<arguments.length&&Ca(Jf);ze.call(this);this.Ud=100;this.Ha=!1;this.di="pointer";var a=new R,b=new Kf;b.isPanelMain=!0;b.stroke="blue";a.add(b);b=new Kf;b.toArrow="Standard";b.fill="blue";b.stroke="blue";a.add(b);a.layerName="Tool";this.lj=a;a=new V;b=new Kf;b.portId="";b.figure="Rectangle";b.fill=null;b.stroke="magenta";b.strokeWidth=2;b.desiredSize=Qb;a.add(b);a.selectable=!1;a.layerName="Tool";this.kj=a;this.j=b;a=new V;b=new Kf;b.portId="";b.figure="Rectangle";b.fill=null;b.stroke=
"magenta";b.strokeWidth=2;b.desiredSize=Qb;a.add(b);a.selectable=!1;a.layerName="Tool";this.Dk=a;this.o=b;this.Td=this.xc=this.Mb=this.Ra=this.Wb=null;this.Da=!0;this.Vm=new yb;this.te=this.ui=this.jj=null}ma(Jf,ze);Jf.prototype.doStop=function(){this.diagram.Fg();this.originalToPort=this.originalToNode=this.originalFromPort=this.originalFromNode=this.originalLink=null;this.validPortsCache.clear();this.targetPort=null};
Jf.prototype.copyPortProperties=function(a,b,c,d,e){if(null!==a&&null!==b&&null!==c&&null!==d){var f=b.Mf(),g=Hb.alloc();g.width=b.naturalBounds.width*f;g.height=b.naturalBounds.height*f;d.desiredSize=g;Hb.free(g);e?(d.toSpot=b.toSpot,d.toEndSegmentLength=b.toEndSegmentLength):(d.fromSpot=b.fromSpot,d.fromEndSegmentLength=b.fromEndSegmentLength);c.locationSpot=Ic;f=K.alloc();c.location=b.ja(Ic,f);K.free(f);d.angle=b.Vi();null!==this.portTargeted&&this.portTargeted(a,b,c,d,e)}};
Jf.prototype.setNoTargetPortProperties=function(a,b,c){null!==b&&(b.desiredSize=Qb,b.fromSpot=Bc,b.toSpot=Bc);null!==a&&(a.location=this.diagram.lastInput.documentPoint);null!==this.portTargeted&&this.portTargeted(null,null,a,b,c)};Jf.prototype.doMouseDown=function(){this.isActive&&this.doMouseMove()};
Jf.prototype.doMouseMove=function(){if(this.isActive){var a=this.diagram;this.targetPort=this.findTargetPort(this.isForwards);if(null!==this.targetPort&&this.targetPort.part instanceof V){var b=this.targetPort.part;this.isForwards?this.copyPortProperties(b,this.targetPort,this.temporaryToNode,this.temporaryToPort,!0):this.copyPortProperties(b,this.targetPort,this.temporaryFromNode,this.temporaryFromPort,!1)}else this.isForwards?this.setNoTargetPortProperties(this.temporaryToNode,this.temporaryToPort,
!0):this.setNoTargetPortProperties(this.temporaryFromNode,this.temporaryFromPort,!1);(a.allowHorizontalScroll||a.allowVerticalScroll)&&a.zs(a.lastInput.viewPoint)}};Jf.prototype.findValidLinkablePort=function(a,b){if(null===a)return null;var c=a.part;if(!(c instanceof V))return null;for(;null!==a;){var d=b?a.toLinkable:a.fromLinkable;if(!0===d&&(null!==a.portId||a instanceof V)&&(b?this.isValidTo(c,a):this.isValidFrom(c,a)))return a;if(!1===d)break;a=a.panel}return null};
Jf.prototype.findTargetPort=function(a){var b=this.diagram,c=b.lastInput.documentPoint,d=this.portGravity;0>=d&&(d=.1);var e=this,f=b.Bg(c,d,function(b){return e.findValidLinkablePort(b,a)},null,!0);d=Infinity;b=null;for(f=f.iterator;f.next();){var g=f.value,h=g.part;if(h instanceof V){var k=g.ja(Ic,K.alloc()),l=c.x-k.x,m=c.y-k.y;K.free(k);k=l*l+m*m;k<d&&(l=this.validPortsCache.K(g),null!==l?l&&(b=g,d=k):a&&this.isValidLink(this.originalFromNode,this.originalFromPort,h,g)||!a&&this.isValidLink(h,
g,this.originalToNode,this.originalToPort)?(this.validPortsCache.add(g,!0),b=g,d=k):this.validPortsCache.add(g,!1))}}return null!==b&&(c=b.part,c instanceof V&&(null===c.layer||c.layer.allowLink))?b:null};
Jf.prototype.isValidFrom=function(a,b){if(null===a||null===b)return this.isUnconnectedLinkValid;if(this.diagram.currentTool===this&&(null!==a.layer&&!a.layer.allowLink||!0!==b.fromLinkable))return!1;var c=b.fromMaxLinks;if(Infinity>c){if(null!==this.originalLink&&a===this.originalFromNode&&b===this.originalFromPort)return!0;b=b.portId;null===b&&(b="");if(a.iq(b).count>=c)return!1}return!0};
Jf.prototype.isValidTo=function(a,b){if(null===a||null===b)return this.isUnconnectedLinkValid;if(this.diagram.currentTool===this&&(null!==a.layer&&!a.layer.allowLink||!0!==b.toLinkable))return!1;var c=b.toMaxLinks;if(Infinity>c){if(null!==this.originalLink&&a===this.originalToNode&&b===this.originalToPort)return!0;b=b.portId;null===b&&(b="");if(a.Nd(b).count>=c)return!1}return!0};
Jf.prototype.isInSameNode=function(a,b){if(null===a||null===b)return!1;if(a===b)return!0;a=a.part;b=b.part;return null!==a&&a===b};Jf.prototype.isLinked=function(a,b){if(null===a||null===b)return!1;var c=a.part;if(!(c instanceof V))return!1;a=a.portId;null===a&&(a="");var d=b.part;if(!(d instanceof V))return!1;b=b.portId;null===b&&(b="");for(b=d.Nd(b);b.next();)if(d=b.value,d.fromNode===c&&d.fromPortId===a)return!0;return!1};
Jf.prototype.isValidLink=function(a,b,c,d){if(!this.isValidFrom(a,b)||!this.isValidTo(c,d)||!(null===b||null===d||(b.fromLinkableSelfNode&&d.toLinkableSelfNode||!this.isInSameNode(b,d))&&(b.fromLinkableDuplicates&&d.toLinkableDuplicates||!this.isLinked(b,d)))||null!==this.originalLink&&(null!==a&&this.isLabelDependentOnLink(a,this.originalLink)||null!==c&&this.isLabelDependentOnLink(c,this.originalLink))||null!==a&&null!==c&&(null===a.data&&null!==c.data||null!==a.data&&null===c.data)||!this.isValidCycle(a,
c,this.originalLink))return!1;if(null!==a){var e=a.linkValidation;if(null!==e&&!e(a,b,c,d,this.originalLink))return!1}if(null!==c&&(e=c.linkValidation,null!==e&&!e(a,b,c,d,this.originalLink)))return!1;e=this.linkValidation;return null!==e?e(a,b,c,d,this.originalLink):!0};Jf.prototype.isLabelDependentOnLink=function(a,b){if(null===a)return!1;var c=a.labeledLink;if(null===c)return!1;if(c===b)return!0;var d=new I;d.add(a);return Lf(this,c,b,d)};
function Lf(a,b,c,d){if(b===c)return!0;var e=b.fromNode;if(null!==e&&e.isLinkLabel&&(d.add(e),Lf(a,e.labeledLink,c,d)))return!0;b=b.toNode;return null!==b&&b.isLinkLabel&&(d.add(b),Lf(a,b.labeledLink,c,d))?!0:!1}
Jf.prototype.isValidCycle=function(a,b,c){void 0===c&&(c=null);if(null===a||null===b)return this.isUnconnectedLinkValid;var d=this.diagram.validCycle;if(d!==Mf){if(d===Nf){d=c||this.temporaryLink;if(null!==d&&!d.isTreeLink)return!0;for(d=b.linksConnected;d.next();){var e=d.value;if(e!==c&&e.isTreeLink&&e.toNode===b)return!1}return!Of(this,a,b,c,!0)}if(d===Pf){d=c||this.temporaryLink;if(null!==d&&!d.isTreeLink)return!0;for(d=a.linksConnected;d.next();)if(e=d.value,e!==c&&e.isTreeLink&&e.fromNode===
a)return!1;return!Of(this,a,b,c,!0)}if(d===Tf)return a===b?a=!0:(d=new I,d.add(b),a=Uf(this,d,a,b,c)),!a;if(d===Vf)return!Of(this,a,b,c,!1);if(d===Wf)return a===b?a=!0:(d=new I,d.add(b),a=Xf(this,d,a,b,c)),!a}return!0};function Of(a,b,c,d,e){if(b===c)return!0;if(null===b||null===c)return!1;for(var f=b.linksConnected;f.next();){var g=f.value;if(g!==d&&(!e||g.isTreeLink)&&g.toNode===b&&(g=g.fromNode,g!==b&&Of(a,g,c,d,e)))return!0}return!1}
function Uf(a,b,c,d,e){if(c===d)return!0;if(null===c||null===d||b.contains(c))return!1;b.add(c);for(var f=c.linksConnected;f.next();){var g=f.value;if(g!==e&&g.toNode===c&&(g=g.fromNode,g!==c&&Uf(a,b,g,d,e)))return!0}return!1}function Xf(a,b,c,d,e){if(c===d)return!0;if(null===c||null===d||b.contains(c))return!1;b.add(c);for(var f=c.linksConnected;f.next();){var g=f.value;if(g!==e){var h=g.fromNode;g=g.toNode;h=h===c?g:h;if(h!==c&&Xf(a,b,h,d,e))return!0}}return!1}
na.Object.defineProperties(Jf.prototype,{portGravity:{configurable:!0,get:function(){return this.Ud},set:function(a){A(a,"number",Jf,"portGravity");0<=a&&(this.Ud=a)}},isUnconnectedLinkValid:{configurable:!0,get:function(){return this.Ha},set:function(a){A(a,"boolean",Jf,"isUnconnectedLinkValid");this.Ha=a}},linkingCursor:{configurable:!0,get:function(){return this.di},set:function(a){this.di=a}},temporaryLink:{configurable:!0,get:function(){return this.lj},
set:function(a){w(a,R,Jf,"temporaryLink");this.lj=a}},temporaryFromNode:{configurable:!0,get:function(){return this.kj},set:function(a){w(a,V,Jf,"temporaryFromNode");if(this.kj=a)this.j=a.port}},temporaryFromPort:{configurable:!0,get:function(){return this.j},set:function(a){w(a,O,Jf,"temporaryFromPort");if(null!==this.j){var b=this.j.panel;if(null!==b){var c=b.W.indexOf(this.j);b.kb(c);b.Bb(c,a)}}this.j=a}},temporaryToNode:{configurable:!0,get:function(){return this.Dk},
set:function(a){w(a,V,Jf,"temporaryToNode");if(this.Dk=a)this.o=a.port}},temporaryToPort:{configurable:!0,get:function(){return this.o},set:function(a){w(a,O,Jf,"temporaryToPort");if(null!==this.o){var b=this.o.panel;if(null!==b){var c=b.W.indexOf(this.o);b.kb(c);b.Bb(c,a)}}this.o=a}},originalLink:{configurable:!0,get:function(){return this.Wb},set:function(a){null!==a&&w(a,R,Jf,"originalLink");this.Wb=a}},originalFromNode:{configurable:!0,get:function(){return this.Ra},
set:function(a){null!==a&&w(a,V,Jf,"originalFromNode");this.Ra=a}},originalFromPort:{configurable:!0,get:function(){return this.Mb},set:function(a){null!==a&&w(a,O,Jf,"originalFromPort");this.Mb=a}},originalToNode:{configurable:!0,get:function(){return this.xc},set:function(a){null!==a&&w(a,V,Jf,"originalToNode");this.xc=a}},originalToPort:{configurable:!0,get:function(){return this.Td},set:function(a){null!==a&&w(a,O,Jf,"originalToPort");this.Td=a}},isForwards:{configurable:!0,
enumerable:!0,get:function(){return this.Da},set:function(a){A(a,"boolean",Jf,"isForwards");this.Da=a}},validPortsCache:{configurable:!0,get:function(){return this.Vm}},targetPort:{configurable:!0,get:function(){return this.jj},set:function(a){null!==a&&w(a,O,Jf,"targetPort");this.jj=a}},linkValidation:{configurable:!0,get:function(){return this.ui},set:function(a){null!==a&&A(a,"function",Jf,"linkValidation");this.ui=a}},portTargeted:{configurable:!0,
get:function(){return this.te},set:function(a){null!==a&&A(a,"function",Jf,"portTargeted");this.te=a}}});Jf.className="LinkingBaseTool";function Yf(){0<arguments.length&&Ca(Yf);Jf.call(this);this.name="Linking";this.O={};this.F=null;this.N=Zf;this.Ic=null}ma(Yf,Jf);Yf.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return a.isReadOnly||a.isModelReadOnly||!a.allowLink||!a.model.Qs()||!a.lastInput.left||a.currentTool!==this&&!this.isBeyondDragSize()?!1:null!==this.findLinkablePort()};
Yf.prototype.findLinkablePort=function(){var a=this.diagram,b=this.startObject;null===b&&(b=a.dc(a.firstInput.documentPoint,null,null));if(null===b)return null;a=b.part;if(!(a instanceof V))return null;var c=this.direction;if(c===Zf||c===$f){var d=this.findValidLinkablePort(b,!1);if(null!==d||this.startObject===a&&(d=a.port,this.findValidLinkablePort(d,!1)))return this.isForwards=!0,d}if(c===Zf||c===ag)if(b=this.findValidLinkablePort(b,!0),null!==b||this.startObject===a&&(b=a.port,this.findValidLinkablePort(b,
!0)))return this.isForwards=!1,b;return null};
Yf.prototype.doActivate=function(){var a=this.diagram,b=this.findLinkablePort();null===b?this.stopTool():(this.Ea(this.name),a.isMouseCaptured=!0,a.currentCursor=this.linkingCursor,this.isForwards?(null===this.temporaryToNode||this.temporaryToNode.location.s()||(this.temporaryToNode.location=a.lastInput.documentPoint),this.originalFromPort=b,b=this.originalFromPort.part,b instanceof V&&(this.originalFromNode=b),this.copyPortProperties(this.originalFromNode,this.originalFromPort,this.temporaryFromNode,
this.temporaryFromPort,!1)):(null===this.temporaryFromNode||this.temporaryFromNode.location.s()||(this.temporaryFromNode.location=a.lastInput.documentPoint),this.originalToPort=b,b=this.originalToPort.part,b instanceof V&&(this.originalToNode=b),this.copyPortProperties(this.originalToNode,this.originalToPort,this.temporaryToNode,this.temporaryToPort,!0)),a.add(this.temporaryFromNode),a.add(this.temporaryToNode),null!==this.temporaryLink&&(null!==this.temporaryFromNode&&(this.temporaryLink.fromNode=
this.temporaryFromNode),null!==this.temporaryToNode&&(this.temporaryLink.toNode=this.temporaryToNode),this.temporaryLink.isTreeLink=this.isNewTreeLink(),this.temporaryLink.$a(),a.add(this.temporaryLink)),this.isActive=!0)};Yf.prototype.doDeactivate=function(){this.isActive=!1;var a=this.diagram;a.remove(this.temporaryLink);a.remove(this.temporaryFromNode);a.remove(this.temporaryToNode);a.isMouseCaptured=!1;a.currentCursor="";this.stopTransaction()};
Yf.prototype.doStop=function(){Jf.prototype.doStop.call(this);this.startObject=null};
Yf.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram,b=this.transactionResult=null,c=null,d=null,e=null,f=null;try{var g=this.targetPort=this.findTargetPort(this.isForwards);if(null!==g){var h=g.part;h instanceof V&&(this.isForwards?(null!==this.originalFromNode&&(b=this.originalFromNode,c=this.originalFromPort),d=h,e=g):(b=h,c=g,null!==this.originalToNode&&(d=this.originalToNode,e=this.originalToPort)))}else this.isForwards?null!==this.originalFromNode&&this.isUnconnectedLinkValid&&
(b=this.originalFromNode,c=this.originalFromPort):null!==this.originalToNode&&this.isUnconnectedLinkValid&&(d=this.originalToNode,e=this.originalToPort);null!==b||null!==d?(f=this.insertLink(b,c,d,e),null!==f?(null===g&&(this.isForwards?f.defaultToPoint=a.lastInput.documentPoint:f.defaultFromPoint=a.lastInput.documentPoint),a.allowSelect&&(a.V("ChangingSelection",a.selection),a.clearSelection(!0),f.isSelected=!0),this.transactionResult=this.name,a.V("LinkDrawn",f)):this.doNoLink(b,c,d,e)):this.isForwards?
this.doNoLink(this.originalFromNode,this.originalFromPort,null,null):this.doNoLink(null,null,this.originalToNode,this.originalToPort)}finally{this.stopTool(),f&&a.allowSelect&&a.V("ChangedSelection",a.selection)}}};Yf.prototype.isNewTreeLink=function(){var a=this.archetypeLinkData;if(null===a)return!0;if(a instanceof R)return a.isTreeLink;var b=this.diagram;if(null===b)return!0;a=b.partManager.getLinkCategoryForData(a);b=b.partManager.findLinkTemplateForCategory(a);return null!==b?b.isTreeLink:!0};
Yf.prototype.insertLink=function(a,b,c,d){return this.diagram.partManager.insertLink(a,b,c,d)};Yf.prototype.doNoLink=function(){};
na.Object.defineProperties(Yf.prototype,{archetypeLinkData:{configurable:!0,get:function(){return this.O},set:function(a){null!==a&&A(a,"object",Yf,"archetypeLinkData");a instanceof O&&w(a,R,Yf,"archetypeLinkData");this.O=a}},archetypeLabelNodeData:{configurable:!0,get:function(){return this.F},set:function(a){null!==a&&A(a,"object",Yf,"archetypeLabelNodeData");a instanceof O&&w(a,V,Yf,"archetypeLabelNodeData");this.F=a}},direction:{configurable:!0,get:function(){return this.N},
set:function(a){db(a,Yf,Yf,"direction");this.N=a}},startObject:{configurable:!0,get:function(){return this.Ic},set:function(a){null!==a&&w(a,O,Yf,"startObject");this.Ic=a}}});var Zf=new F(Yf,"Either",0),$f=new F(Yf,"ForwardsOnly",0),ag=new F(Yf,"BackwardsOnly",0);Yf.className="LinkingTool";Yf.Either=Zf;Yf.ForwardsOnly=$f;Yf.BackwardsOnly=ag;
function cf(){0<arguments.length&&Ca(cf);Jf.call(this);this.name="Relinking";var a=new Kf;a.figure="Diamond";a.desiredSize=Ub;a.fill="lightblue";a.stroke="dodgerblue";a.cursor=this.linkingCursor;a.segmentIndex=0;this.O=a;a=new Kf;a.figure="Diamond";a.desiredSize=Ub;a.fill="lightblue";a.stroke="dodgerblue";a.cursor=this.linkingCursor;a.segmentIndex=-1;this.Ic=a;this.F=null;this.qx=new M}ma(cf,Jf);
cf.prototype.updateAdornments=function(a){if(null!==a&&a instanceof R){var b="RelinkFrom",c=null;if(a.isSelected&&!this.diagram.isReadOnly){var d=a.selectionObject;null!==d&&a.canRelinkFrom()&&a.actualBounds.s()&&a.isVisible()&&d.actualBounds.s()&&d.Rf()&&(c=a.hk(b),null===c&&(c=this.makeAdornment(d,!1),a.Ih(b,c)))}null===c&&a.Sf(b);b="RelinkTo";c=null;a.isSelected&&!this.diagram.isReadOnly&&(d=a.selectionObject,null!==d&&a.canRelinkTo()&&a.actualBounds.s()&&a.isVisible()&&d.actualBounds.s()&&d.Rf()&&
(c=a.hk(b),null===c?(c=this.makeAdornment(d,!0),a.Ih(b,c)):c.v()));null===c&&a.Sf(b)}};cf.prototype.makeAdornment=function(a,b){var c=new Ke;c.type=X.Link;b=b?this.toHandleArchetype:this.fromHandleArchetype;null!==b&&c.add(b.copy());c.adornedObject=a;return c};
cf.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowRelink||!a.model.Qs()||!a.lastInput.left)return!1;var b=this.findToolHandleAt(a.firstInput.documentPoint,"RelinkFrom");null===b&&(b=this.findToolHandleAt(a.firstInput.documentPoint,"RelinkTo"));return null!==b};
cf.prototype.doActivate=function(){var a=this.diagram;if(null===this.originalLink){var b=this.handle;null===b&&(b=this.findToolHandleAt(a.firstInput.documentPoint,"RelinkFrom"),null===b&&(b=this.findToolHandleAt(a.firstInput.documentPoint,"RelinkTo")));if(null===b)return;var c=b.part;if(!(c instanceof Ke&&c.adornedPart instanceof R))return;this.handle=b;this.isForwards=null===c||"RelinkTo"===c.category;this.originalLink=c.adornedPart}this.Ea(this.name);a.isMouseCaptured=!0;a.currentCursor=this.linkingCursor;
this.originalFromPort=this.originalLink.fromPort;this.originalFromNode=this.originalLink.fromNode;this.originalToPort=this.originalLink.toPort;this.originalToNode=this.originalLink.toNode;this.qx.set(this.originalLink.actualBounds);null!==this.originalLink&&0<this.originalLink.pointsCount&&(null===this.originalLink.fromNode&&(null!==this.temporaryFromPort&&(this.temporaryFromPort.desiredSize=Pb),null!==this.temporaryFromNode&&(this.temporaryFromNode.location=this.originalLink.i(0))),null===this.originalLink.toNode&&
(null!==this.temporaryToPort&&(this.temporaryToPort.desiredSize=Pb),null!==this.temporaryToNode&&(this.temporaryToNode.location=this.originalLink.i(this.originalLink.pointsCount-1))));this.copyPortProperties(this.originalFromNode,this.originalFromPort,this.temporaryFromNode,this.temporaryFromPort,!1);this.copyPortProperties(this.originalToNode,this.originalToPort,this.temporaryToNode,this.temporaryToPort,!0);a.add(this.temporaryFromNode);a.add(this.temporaryToNode);null!==this.temporaryLink&&(null!==
this.temporaryFromNode&&(this.temporaryLink.fromNode=this.temporaryFromNode),null!==this.temporaryToNode&&(this.temporaryLink.toNode=this.temporaryToNode),this.copyLinkProperties(this.originalLink,this.temporaryLink),this.temporaryLink.$a(),a.add(this.temporaryLink));this.isActive=!0};
cf.prototype.copyLinkProperties=function(a,b){if(null!==a&&null!==b){b.adjusting=a.adjusting;b.corner=a.corner;var c=a.curve;if(c===bg||c===cg)c=dg;b.curve=c;b.curviness=a.curviness;b.isTreeLink=a.isTreeLink;b.points=a.points;b.routing=a.routing;b.smoothness=a.smoothness;b.fromSpot=a.fromSpot;b.fromEndSegmentLength=a.fromEndSegmentLength;b.fromShortLength=a.fromShortLength;b.toSpot=a.toSpot;b.toEndSegmentLength=a.toEndSegmentLength;b.toShortLength=a.toShortLength}};
cf.prototype.doDeactivate=function(){this.isActive=!1;var a=this.diagram;a.remove(this.temporaryLink);a.remove(this.temporaryFromNode);a.remove(this.temporaryToNode);a.isMouseCaptured=!1;a.currentCursor="";this.stopTransaction()};cf.prototype.doStop=function(){Jf.prototype.doStop.call(this);this.handle=null};
cf.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram;this.transactionResult=null;var b=this.originalFromNode,c=this.originalFromPort,d=this.originalToNode,e=this.originalToPort,f=this.originalLink;try{this.targetPort=this.findTargetPort(this.isForwards);if(null!==this.targetPort){var g=this.targetPort.part;g instanceof V&&(this.isForwards?(d=g,e=this.targetPort):(b=g,c=this.targetPort))}else this.isUnconnectedLinkValid?this.isForwards?e=d=null:c=b=null:f=null;null!==f?(this.reconnectLink(f,
this.isForwards?d:b,this.isForwards?e:c,this.isForwards),null===this.targetPort&&(this.isForwards?f.defaultToPoint=a.lastInput.documentPoint:f.defaultFromPoint=a.lastInput.documentPoint,f.$a()),this.transactionResult=this.name,a.V("LinkRelinked",f,this.isForwards?this.originalToPort:this.originalFromPort)):this.doNoRelink(this.originalLink,this.isForwards);this.originalLink.rq(this.qx)}finally{this.stopTool()}}};
cf.prototype.reconnectLink=function(a,b,c,d){c=null!==c&&null!==c.portId?c.portId:"";d?(a.toNode=b,a.toPortId=c):(a.fromNode=b,a.fromPortId=c);return!0};cf.prototype.doNoRelink=function(){};
function Cf(a,b,c,d,e){null!==b?(a.copyPortProperties(b,c,a.temporaryFromNode,a.temporaryFromPort,!1),a.diagram.add(a.temporaryFromNode)):a.diagram.remove(a.temporaryFromNode);null!==d?(a.copyPortProperties(d,e,a.temporaryToNode,a.temporaryToPort,!0),a.diagram.add(a.temporaryToNode)):a.diagram.remove(a.temporaryToNode)}
na.Object.defineProperties(cf.prototype,{fromHandleArchetype:{configurable:!0,get:function(){return this.O},set:function(a){null!==a&&w(a,O,cf,"fromHandleArchetype");this.O=a}},toHandleArchetype:{configurable:!0,get:function(){return this.Ic},set:function(a){null!==a&&w(a,O,cf,"toHandleArchetype");this.Ic=a}},handle:{configurable:!0,get:function(){return this.F},set:function(a){if(null!==a&&(w(a,O,cf,"handle"),!(a.part instanceof Ke)))throw Error("new handle is not in an Adornment: "+
a);this.F=a}}});cf.className="RelinkingTool";Ua("linkingTool",function(){return this.findTool("Linking")},function(a){this.gb("Linking",a,this.mouseMoveTools)});Ua("relinkingTool",function(){return this.findTool("Relinking")},function(a){this.gb("Relinking",a,this.mouseDownTools)});
function eg(){0<arguments.length&&Ca(eg);ze.call(this);this.name="LinkReshaping";var a=new Kf;a.figure="Rectangle";a.desiredSize=Rb;a.fill="lightblue";a.stroke="dodgerblue";this.o=a;a=new Kf;a.figure="Diamond";a.desiredSize=Ub;a.fill="lightblue";a.stroke="dodgerblue";a.cursor="move";this.F=a;this.O=3;this.Bt=this.j=null;this.sx=new K;this.Sr=new H}ma(eg,ze);eg.prototype.jv=function(a){return a&&a.Wr&&0!==a.Wr.value?a.Wr:fg};
eg.prototype.Mm=function(a,b){w(a,O,eg,"setReshapingBehavior:obj");db(b,eg,eg,"setReshapingBehavior:behavior");a.Wr=b};
eg.prototype.updateAdornments=function(a){if(null!==a&&a instanceof R){var b=null;if(a.isSelected&&!this.diagram.isReadOnly){var c=a.path;null!==c&&a.canReshape()&&a.actualBounds.s()&&a.isVisible()&&c.actualBounds.s()&&c.Rf()&&(b=a.hk(this.name),null===b||b.mx!==a.pointsCount||b.Gx!==a.resegmentable)&&(b=this.makeAdornment(c),null!==b&&(b.mx=a.pointsCount,b.Gx=a.resegmentable,a.Ih(this.name,b)))}null===b&&a.Sf(this.name)}};
eg.prototype.makeAdornment=function(a){var b=a.part,c=b.pointsCount,d=b.isOrthogonal,e=null;if(null!==b.points&&1<c){e=new Ke;e.type=X.Link;c=b.firstPickIndex;var f=b.lastPickIndex,g=d?1:0;if(b.resegmentable&&b.computeCurve()!==gg)for(var h=c+g;h<f-g;h++){var k=this.makeResegmentHandle(a,h);null!==k&&(k.segmentIndex=h,k.segmentFraction=.5,k.fromMaxLinks=999,e.add(k))}for(g=c+1;g<f;g++)if(h=this.makeHandle(a,g),null!==h){h.segmentIndex=g;if(g!==c)if(g===c+1&&d){k=b.i(c);var l=b.i(c+1);L.A(k.x,l.x)&&
L.A(k.y,l.y)&&(l=b.i(c-1));L.A(k.x,l.x)?(this.Mm(h,hg),h.cursor="n-resize"):L.A(k.y,l.y)&&(this.Mm(h,ig),h.cursor="w-resize")}else g===f-1&&d?(k=b.i(f-1),l=b.i(f),L.A(k.x,l.x)&&L.A(k.y,l.y)&&(k=b.i(f+1)),L.A(k.x,l.x)?(this.Mm(h,hg),h.cursor="n-resize"):L.A(k.y,l.y)&&(this.Mm(h,ig),h.cursor="w-resize")):g!==f&&(this.Mm(h,jg),h.cursor="move");e.add(h)}e.adornedObject=a}return e};eg.prototype.makeHandle=function(){var a=this.handleArchetype;return null===a?null:a.copy()};
eg.prototype.makeResegmentHandle=function(){var a=this.midHandleArchetype;return null===a?null:a.copy()};eg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return!a.isReadOnly&&a.allowReshape&&a.lastInput.left?null!==this.findToolHandleAt(a.firstInput.documentPoint,this.name):!1};
eg.prototype.doActivate=function(){var a=this.diagram;null===this.handle&&(this.handle=this.findToolHandleAt(a.firstInput.documentPoint,this.name));if(null!==this.handle){var b=this.handle.part.adornedPart;if(b instanceof R){this.Bt=b;a.isMouseCaptured=!0;this.Ea(this.name);if(b.resegmentable&&999===this.handle.fromMaxLinks){var c=b.points.copy(),d=this.getResegmentingPoint();c.Bb(this.handle.segmentIndex+1,d);b.isOrthogonal&&c.Bb(this.handle.segmentIndex+1,d);b.points=c;b.Rb();b.updateAdornments();
this.handle=this.findToolHandleAt(a.firstInput.documentPoint,this.name);if(null===this.handle){this.doDeactivate();return}}this.sx=b.i(this.handle.segmentIndex);this.Sr=b.points.copy();this.isActive=!0}}};eg.prototype.doDeactivate=function(){this.stopTransaction();this.Bt=this.handle=null;this.isActive=this.diagram.isMouseCaptured=!1};eg.prototype.doCancel=function(){var a=this.adornedLink;null!==a&&(a.points=this.Sr);this.stopTool()};eg.prototype.getResegmentingPoint=function(){return this.handle.ja(Ic)};
eg.prototype.doMouseMove=function(){var a=this.diagram;this.isActive&&(a=this.computeReshape(a.lastInput.documentPoint),this.reshape(a))};
eg.prototype.doMouseUp=function(){var a=this.diagram;if(this.isActive){var b=this.computeReshape(a.lastInput.documentPoint);this.reshape(b);b=this.adornedLink;if(null!==b&&b.resegmentable){var c=this.handle.segmentIndex,d=b.i(c-1),e=b.i(c),f=b.i(c+1);if(b.isOrthogonal){if(c>b.firstPickIndex+1&&c<b.lastPickIndex-1){var g=b.i(c-2);if(Math.abs(d.x-e.x)<this.resegmentingDistance&&Math.abs(d.y-e.y)<this.resegmentingDistance&&(kg(this,g,d,e,f,!0)||kg(this,g,d,e,f,!1))){var h=b.points.copy();kg(this,g,d,
e,f,!0)?(h.Vc(c-2,new K(g.x,(f.y+g.y)/2)),h.Vc(c+1,new K(f.x,(f.y+g.y)/2))):(h.Vc(c-2,new K((f.x+g.x)/2,g.y)),h.Vc(c+1,new K((f.x+g.x)/2,f.y)));h.kb(c);h.kb(c-1);b.points=h;b.Rb()}else g=b.i(c+2),Math.abs(e.x-f.x)<this.resegmentingDistance&&Math.abs(e.y-f.y)<this.resegmentingDistance&&(kg(this,d,e,f,g,!0)||kg(this,d,e,f,g,!1))&&(h=b.points.copy(),kg(this,d,e,f,g,!0)?(h.Vc(c-1,new K(d.x,(d.y+g.y)/2)),h.Vc(c+2,new K(g.x,(d.y+g.y)/2))):(h.Vc(c-1,new K((d.x+g.x)/2,d.y)),h.Vc(c+2,new K((d.x+g.x)/2,g.y))),
h.kb(c+1),h.kb(c),b.points=h,b.Rb())}}else g=K.alloc(),L.Th(d.x,d.y,f.x,f.y,e.x,e.y,g)&&g.Jf(e)<this.resegmentingDistance*this.resegmentingDistance&&(d=b.points.copy(),d.kb(c),b.points=d,b.Rb()),K.free(g)}a.Wa();this.transactionResult=this.name;a.V("LinkReshaped",this.adornedLink,this.Sr)}this.stopTool()};
function kg(a,b,c,d,e,f){return f?Math.abs(b.y-c.y)<a.resegmentingDistance&&Math.abs(c.y-d.y)<a.resegmentingDistance&&Math.abs(d.y-e.y)<a.resegmentingDistance:Math.abs(b.x-c.x)<a.resegmentingDistance&&Math.abs(c.x-d.x)<a.resegmentingDistance&&Math.abs(d.x-e.x)<a.resegmentingDistance}
eg.prototype.reshape=function(a){var b=this.adornedLink;b.Wh();var c=this.handle.segmentIndex,d=this.jv(this.handle);if(b.isOrthogonal)if(c===b.firstPickIndex+1)c=b.firstPickIndex+1,d===hg?(b.P(c,b.i(c-1).x,a.y),b.P(c+1,b.i(c+2).x,a.y)):d===ig&&(b.P(c,a.x,b.i(c-1).y),b.P(c+1,a.x,b.i(c+2).y));else if(c===b.lastPickIndex-1)c=b.lastPickIndex-1,d===hg?(b.P(c-1,b.i(c-2).x,a.y),b.P(c,b.i(c+1).x,a.y)):d===ig&&(b.P(c-1,a.x,b.i(c-2).y),b.P(c,a.x,b.i(c+1).y));else{d=c;var e=b.i(d),f=b.i(d-1),g=b.i(d+1);L.A(f.x,
e.x)&&L.A(e.y,g.y)?(L.A(f.x,b.i(d-2).x)&&!L.A(f.y,b.i(d-2).y)?(b.l(d,a.x,f.y),c++,d++):b.P(d-1,a.x,f.y),L.A(g.y,b.i(d+2).y)&&!L.A(g.x,b.i(d+2).x)?b.l(d+1,g.x,a.y):b.P(d+1,g.x,a.y)):L.A(f.y,e.y)&&L.A(e.x,g.x)?(L.A(f.y,b.i(d-2).y)&&!L.A(f.x,b.i(d-2).x)?(b.l(d,f.x,a.y),c++,d++):b.P(d-1,f.x,a.y),L.A(g.x,b.i(d+2).x)&&!L.A(g.y,b.i(d+2).y)?b.l(d+1,a.x,g.y):b.P(d+1,a.x,g.y)):L.A(f.x,e.x)&&L.A(e.x,g.x)?(L.A(f.x,b.i(d-2).x)&&!L.A(f.y,b.i(d-2).y)?(b.l(d,a.x,f.y),c++,d++):b.P(d-1,a.x,f.y),L.A(g.x,b.i(d+2).x)&&
!L.A(g.y,b.i(d+2).y)?b.l(d+1,a.x,g.y):b.P(d+1,a.x,g.y)):L.A(f.y,e.y)&&L.A(e.y,g.y)&&(L.A(f.y,b.i(d-2).y)&&!L.A(f.x,b.i(d-2).x)?(b.l(d,f.x,a.y),c++,d++):b.P(d-1,f.x,a.y),L.A(g.y,b.i(d+2).y)&&!L.A(g.x,b.i(d+2).x)?b.l(d+1,g.x,a.y):b.P(d+1,g.x,a.y));b.P(c,a.x,a.y)}else b.P(c,a.x,a.y),d=b.fromNode,e=b.fromPort,null!==d&&(f=d.findVisibleNode(),null!==f&&f!==d&&(d=f,e=d.port)),1===c&&b.computeSpot(!0,e).ec()&&(f=e.ja(Ic,K.alloc()),d=b.getLinkPointFromPoint(d,e,f,a,!0,K.alloc()),b.P(0,d.x,d.y),K.free(f),
K.free(d)),d=b.toNode,e=b.toPort,null!==d&&(f=d.findVisibleNode(),null!==f&&f!==d&&(d=f,e=d.port)),c===b.pointsCount-2&&b.computeSpot(!1,e).ec()&&(c=e.ja(Ic,K.alloc()),a=b.getLinkPointFromPoint(d,e,c,a,!1,K.alloc()),b.P(b.pointsCount-1,a.x,a.y),K.free(c),K.free(a));b.Hf()};eg.prototype.computeReshape=function(a){var b=this.adornedLink,c=this.handle.segmentIndex;switch(this.jv(this.handle)){case jg:return a;case hg:return new K(b.i(c).x,a.y);case ig:return new K(a.x,b.i(c).y);default:case fg:return b.i(c)}};
na.Object.defineProperties(eg.prototype,{handleArchetype:{configurable:!0,get:function(){return this.o},set:function(a){null!==a&&w(a,O,eg,"handleArchetype");this.o=a}},midHandleArchetype:{configurable:!0,get:function(){return this.F},set:function(a){null!==a&&w(a,O,eg,"midHandleArchetype");this.F=a}},handle:{configurable:!0,get:function(){return this.j},set:function(a){if(null!==a&&(w(a,O,eg,"handle"),!(a.part instanceof Ke)))throw Error("new handle is not in an Adornment: "+
a);this.j=a}},adornedLink:{configurable:!0,get:function(){return this.Bt}},resegmentingDistance:{configurable:!0,get:function(){return this.O},set:function(a){A(a,"number",eg,"resegmentingDistance");this.O=a}},originalPoint:{configurable:!0,get:function(){return this.sx}},originalPoints:{configurable:!0,get:function(){return this.Sr}}});eg.prototype.setReshapingBehavior=eg.prototype.Mm;eg.prototype.getReshapingBehavior=eg.prototype.jv;
var fg=new F(eg,"None",0),ig=new F(eg,"Horizontal",1),hg=new F(eg,"Vertical",2),jg=new F(eg,"All",3);eg.className="LinkReshapingTool";eg.None=fg;eg.Horizontal=ig;eg.Vertical=hg;eg.All=jg;Ua("linkReshapingTool",function(){return this.findTool("LinkReshaping")},function(a){this.gb("LinkReshaping",a,this.mouseDownTools)});
function lg(){0<arguments.length&&Ca(lg);ze.call(this);this.name="Resizing";this.kg=(new Hb(1,1)).freeze();this.jg=(new Hb(9999,9999)).freeze();this.Kg=(new Hb(NaN,NaN)).freeze();this.F=!1;this.O=!0;this.ue=null;var a=new Kf;a.alignmentFocus=Ic;a.figure="Rectangle";a.desiredSize=Rb;a.fill="lightblue";a.stroke="dodgerblue";a.strokeWidth=1;a.cursor="pointer";this.o=a;this.j=null;this.Rr=new K;this.px=new Hb;this.Vo=new K;this.Qt=new Hb(0,0);this.Pt=new Hb(Infinity,Infinity);this.Ot=new Hb(1,1)}
ma(lg,ze);lg.prototype.updateAdornments=function(a){if(!(null===a||a instanceof R)){if(a.isSelected&&!this.diagram.isReadOnly){var b=a.resizeObject,c=a.hk(this.name);if(null!==b&&a.canResize()&&a.actualBounds.s()&&a.isVisible()&&b.actualBounds.s()&&b.Rf()){if(null===c||c.adornedObject!==b)c=this.makeAdornment(b);if(null!==c){b=b.Vi();mg(a)&&this.updateResizeHandles(c,b);a.Ih(this.name,c);return}}}a.Sf(this.name)}};
lg.prototype.makeAdornment=function(a){var b=a.part.resizeAdornmentTemplate;if(null===b){b=new Ke;b.type=X.Spot;b.locationSpot=Ic;var c=new ng;c.isPanelMain=!0;b.add(c);b.add(this.makeHandle(a,Cc));b.add(this.makeHandle(a,Gc));b.add(this.makeHandle(a,Nc));b.add(this.makeHandle(a,Kc));b.add(this.makeHandle(a,kd));b.add(this.makeHandle(a,md));b.add(this.makeHandle(a,nd));b.add(this.makeHandle(a,ld))}else if(og(b),b=b.copy(),null===b)return null;b.adornedObject=a;return b};
lg.prototype.makeHandle=function(a,b){a=this.handleArchetype;if(null===a)return null;a=a.copy();a.alignment=b;return a};
lg.prototype.updateResizeHandles=function(a,b){if(null!==a)if(!a.alignment.Kb()&&("pointer"===a.cursor||0<a.cursor.indexOf("resize")))a:{var c=a.alignment;c.ec()&&(c=Ic);if(0>=c.x)b=0>=c.y?b+225:1<=c.y?b+135:b+180;else if(1<=c.x)0>=c.y?b+=315:1<=c.y&&(b+=45);else if(0>=c.y)b+=270;else if(1<=c.y)b+=90;else break a;0>b?b+=360:360<=b&&(b-=360);a.cursor=22.5>b?"e-resize":67.5>b?"se-resize":112.5>b?"s-resize":157.5>b?"sw-resize":202.5>b?"w-resize":247.5>b?"nw-resize":292.5>b?"n-resize":337.5>b?"ne-resize":
"e-resize"}else if(a instanceof X)for(a=a.elements;a.next();)this.updateResizeHandles(a.value,b)};lg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return!a.isReadOnly&&a.allowResize&&a.lastInput.left?null!==this.findToolHandleAt(a.firstInput.documentPoint,this.name):!1};
lg.prototype.doActivate=function(){var a=this.diagram;null===this.handle&&(this.handle=this.findToolHandleAt(a.firstInput.documentPoint,this.name));null!==this.handle&&(this.adornedObject=this.handle.part.adornedObject,null!==this.adornedObject&&(a.isMouseCaptured=!0,a.animationManager.wc(),this.Ea(this.name),this.Rr.set(this.adornedObject.ja(this.handle.alignment.Dv())),this.Vo.set(this.adornedObject.part.location),this.px.set(this.adornedObject.desiredSize),this.Ot=this.computeCellSize(),this.Qt=
this.computeMinSize(),this.Pt=this.computeMaxSize(),this.isActive=!0))};lg.prototype.doDeactivate=function(){var a=this.diagram;this.stopTransaction();this.ue=this.handle=null;this.isActive=a.isMouseCaptured=!1};lg.prototype.doCancel=function(){null!==this.adornedObject&&(this.adornedObject.desiredSize=this.originalDesiredSize,this.adornedObject.part.location=this.originalLocation);this.stopTool()};
lg.prototype.doMouseMove=function(){var a=this.diagram;if(this.isActive){var b=this.Qt,c=this.Pt,d=this.Ot,e=this.adornedObject.Hs(a.lastInput.documentPoint,K.alloc()),f=this.computeReshape();b=this.computeResize(e,this.handle.alignment,b,c,d,f);this.resize(b);a.od();K.free(e)}};
lg.prototype.doMouseUp=function(){var a=this.diagram;if(this.isActive){var b=this.Qt,c=this.Pt,d=this.Ot,e=this.adornedObject.Hs(a.lastInput.documentPoint,K.alloc()),f=this.computeReshape();b=this.computeResize(e,this.handle.alignment,b,c,d,f);this.resize(b);K.free(e);a.Wa();this.transactionResult=this.name;a.V("PartResized",this.adornedObject,this.originalDesiredSize)}this.stopTool()};
lg.prototype.resize=function(a){var b=this.diagram,c=this.adornedObject;if(null!==c){c.desiredSize=a.size;a=c.part;a.Ya();c=c.ja(this.handle.alignment.Dv());if(a instanceof yf){var d=new H;d.add(a);if(!this.dragsMembers&&null===a.placeholder){var e=new Se;e.dragsMembers=!1}b.moveParts(d,this.oppositePoint.copy().qe(c),!0,e)}else a.location=a.location.copy().qe(c).add(this.oppositePoint);b.od()}};
lg.prototype.computeResize=function(a,b,c,d,e,f){b.ec()&&(b=Ic);var g=this.adornedObject.naturalBounds,h=g.x,k=g.y,l=g.x+g.width,m=g.y+g.height,n=1;if(!f){n=g.width;var p=g.height;0>=n&&(n=1);0>=p&&(p=1);n=p/n}p=K.alloc();L.jq(a.x,a.y,h,k,e.width,e.height,p);a=g.copy();0>=b.x?0>=b.y?(a.x=Math.max(p.x,l-d.width),a.x=Math.min(a.x,l-c.width),a.width=Math.max(l-a.x,c.width),a.y=Math.max(p.y,m-d.height),a.y=Math.min(a.y,m-c.height),a.height=Math.max(m-a.y,c.height),f||(1<=a.height/a.width?(a.height=Math.max(Math.min(n*
a.width,d.height),c.height),a.width=a.height/n):(a.width=Math.max(Math.min(a.height/n,d.width),c.width),a.height=n*a.width),a.x=l-a.width,a.y=m-a.height)):1<=b.y?(a.x=Math.max(p.x,l-d.width),a.x=Math.min(a.x,l-c.width),a.width=Math.max(l-a.x,c.width),a.height=Math.max(Math.min(p.y-k,d.height),c.height),f||(1<=a.height/a.width?(a.height=Math.max(Math.min(n*a.width,d.height),c.height),a.width=a.height/n):(a.width=Math.max(Math.min(a.height/n,d.width),c.width),a.height=n*a.width),a.x=l-a.width)):(a.x=
Math.max(p.x,l-d.width),a.x=Math.min(a.x,l-c.width),a.width=l-a.x,f||(a.height=Math.max(Math.min(n*a.width,d.height),c.height),a.width=a.height/n,a.y=k+.5*(m-k-a.height))):1<=b.x?0>=b.y?(a.width=Math.max(Math.min(p.x-h,d.width),c.width),a.y=Math.max(p.y,m-d.height),a.y=Math.min(a.y,m-c.height),a.height=Math.max(m-a.y,c.height),f||(1<=a.height/a.width?(a.height=Math.max(Math.min(n*a.width,d.height),c.height),a.width=a.height/n):(a.width=Math.max(Math.min(a.height/n,d.width),c.width),a.height=n*a.width),
a.y=m-a.height)):1<=b.y?(a.width=Math.max(Math.min(p.x-h,d.width),c.width),a.height=Math.max(Math.min(p.y-k,d.height),c.height),f||(1<=a.height/a.width?(a.height=Math.max(Math.min(n*a.width,d.height),c.height),a.width=a.height/n):(a.width=Math.max(Math.min(a.height/n,d.width),c.width),a.height=n*a.width))):(a.width=Math.max(Math.min(p.x-h,d.width),c.width),f||(a.height=Math.max(Math.min(n*a.width,d.height),c.height),a.width=a.height/n,a.y=k+.5*(m-k-a.height))):0>=b.y?(a.y=Math.max(p.y,m-d.height),
a.y=Math.min(a.y,m-c.height),a.height=m-a.y,f||(a.width=Math.max(Math.min(a.height/n,d.width),c.width),a.height=n*a.width,a.x=h+.5*(l-h-a.width))):1<=b.y&&(a.height=Math.max(Math.min(p.y-k,d.height),c.height),f||(a.width=Math.max(Math.min(a.height/n,d.width),c.width),a.height=n*a.width,a.x=h+.5*(l-h-a.width)));K.free(p);return a};lg.prototype.computeReshape=function(){var a=pg;this.adornedObject instanceof Kf&&(a=qg(this.adornedObject));return!(a===rg||this.diagram.lastInput.shift)};
lg.prototype.computeMinSize=function(){var a=this.adornedObject.minSize.copy(),b=this.minSize;!isNaN(b.width)&&b.width>a.width&&(a.width=b.width);!isNaN(b.height)&&b.height>a.height&&(a.height=b.height);return a};lg.prototype.computeMaxSize=function(){var a=this.adornedObject.maxSize.copy(),b=this.maxSize;!isNaN(b.width)&&b.width<a.width&&(a.width=b.width);!isNaN(b.height)&&b.height<a.height&&(a.height=b.height);return a};
lg.prototype.computeCellSize=function(){var a=new Hb(NaN,NaN),b=this.adornedObject.part;null!==b&&(b=b.resizeCellSize,!isNaN(b.width)&&0<b.width&&(a.width=b.width),!isNaN(b.height)&&0<b.height&&(a.height=b.height));b=this.cellSize;isNaN(a.width)&&!isNaN(b.width)&&0<b.width&&(a.width=b.width);isNaN(a.height)&&!isNaN(b.height)&&0<b.height&&(a.height=b.height);b=this.diagram;(isNaN(a.width)||isNaN(a.height))&&b&&(b=b.grid,null!==b&&b.visible&&this.isGridSnapEnabled&&(b=b.gridCellSize,isNaN(a.width)&&
!isNaN(b.width)&&0<b.width&&(a.width=b.width),isNaN(a.height)&&!isNaN(b.height)&&0<b.height&&(a.height=b.height)));if(isNaN(a.width)||0===a.width||Infinity===a.width)a.width=1;if(isNaN(a.height)||0===a.height||Infinity===a.height)a.height=1;return a};
na.Object.defineProperties(lg.prototype,{handleArchetype:{configurable:!0,get:function(){return this.o},set:function(a){null!==a&&w(a,O,lg,"handleArchetype");this.o=a}},handle:{configurable:!0,get:function(){return this.j},set:function(a){if(null!==a&&(w(a,O,lg,"handle"),!(a.part instanceof Ke)))throw Error("new handle is not in an Adornment: "+a);this.j=a}},adornedObject:{configurable:!0,get:function(){return this.ue},set:function(a){if(null!==a&&(w(a,O,
lg,"handle"),a.part instanceof Ke))throw Error("new handle must not be in an Adornment: "+a);this.ue=a}},minSize:{configurable:!0,get:function(){return this.kg},set:function(a){w(a,Hb,lg,"minSize");if(!this.kg.B(a)){var b=a.width;isNaN(b)&&(b=0);a=a.height;isNaN(a)&&(a=0);this.kg.h(b,a)}}},maxSize:{configurable:!0,get:function(){return this.jg},set:function(a){w(a,Hb,lg,"maxSize");if(!this.jg.B(a)){var b=a.width;isNaN(b)&&(b=Infinity);a=a.height;isNaN(a)&&(a=Infinity);
this.jg.h(b,a)}}},cellSize:{configurable:!0,get:function(){return this.Kg},set:function(a){w(a,Hb,lg,"cellSize");this.Kg.B(a)||this.Kg.assign(a)}},isGridSnapEnabled:{configurable:!0,get:function(){return this.F},set:function(a){A(a,"boolean",lg,"isGridSnapEnabled");this.F=a}},dragsMembers:{configurable:!0,get:function(){return this.O},set:function(a){A(a,"boolean",lg,"dragsMembers");this.O=a}},oppositePoint:{configurable:!0,get:function(){return this.Rr},
set:function(a){w(a,K,lg,"oppositePoint");this.Rr.B(a)||this.Rr.assign(a)}},originalDesiredSize:{configurable:!0,get:function(){return this.px}},originalLocation:{configurable:!0,get:function(){return this.Vo}}});lg.className="ResizingTool";Ua("resizingTool",function(){return this.findTool("Resizing")},function(a){this.gb("Resizing",a,this.mouseDownTools)});
function sg(){0<arguments.length&&Ca(sg);ze.call(this);this.name="Rotating";this.Ha=45;this.Da=2;this.Vo=new K;this.ue=null;var a=new Kf;a.figure="Ellipse";a.desiredSize=Ub;a.fill="lightblue";a.stroke="dodgerblue";a.strokeWidth=1;a.cursor="pointer";this.o=a;this.j=null;this.ox=0;this.Xr=new K(NaN,NaN);this.F=0;this.O=50}ma(sg,ze);
sg.prototype.updateAdornments=function(a){if(null!==a){if(a.Sh()){var b=a.rotateObject;if(b===a||b===a.path||b.isPanelMain)return}if(a.isSelected&&!this.diagram.isReadOnly&&(b=a.rotateObject,null!==b&&a.canRotate()&&a.actualBounds.s()&&a.isVisible()&&b.actualBounds.s()&&b.Rf())){var c=a.hk(this.name);if(null===c||c.adornedObject!==b)c=this.makeAdornment(b);if(null!==c){c.angle=b.Vi();null===c.placeholder&&(c.location=this.computeAdornmentLocation(b));a.Ih(this.name,c);return}}a.Sf(this.name)}};
sg.prototype.makeAdornment=function(a){var b=a.part.rotateAdornmentTemplate;if(null===b){b=new Ke;b.type=X.Position;b.locationSpot=Ic;var c=this.handleArchetype;null!==c&&b.add(c.copy())}else if(og(b),b=b.copy(),null===b)return null;b.adornedObject=a;return b};sg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return!a.isReadOnly&&a.allowRotate&&a.lastInput.left?null!==this.findToolHandleAt(a.firstInput.documentPoint,this.name):!1};
sg.prototype.doActivate=function(){var a=this.diagram;if(null===this.adornedObject){null===this.handle&&(this.handle=this.findToolHandleAt(a.firstInput.documentPoint,this.name));if(null===this.handle)return;this.adornedObject=this.handle.part.adornedObject}null!==this.adornedObject&&(a.isMouseCaptured=!0,a.delaysLayout=!0,this.Ea(this.name),this.ox=this.adornedObject.angle,this.Xr=this.computeRotationPoint(this.adornedObject),this.Vo=this.adornedObject.part.location.copy(),this.isActive=!0)};
sg.prototype.computeRotationPoint=function(a){var b=a.part,c=b.locationObject;return b.rotationSpot.fb()?a.ja(b.rotationSpot):a===b||a===c?c.ja(b.locationSpot):a.ja(Ic)};
sg.prototype.computeAdornmentLocation=function(a){var b=this.rotationPoint;b.s()||(b=this.computeRotationPoint(a));b=a.Hs(b);var c=this.handleAngle;0>c?c+=360:360<=c&&(c-=360);c=Math.round(45*Math.round(c/45));var d=this.handleDistance;0===c?b.x=a.naturalBounds.width+d:45===c?(b.x=a.naturalBounds.width+d,b.y=a.naturalBounds.height+d):90===c?b.y=a.naturalBounds.height+d:135===c?(b.x=-d,b.y=a.naturalBounds.height+d):180===c?b.x=-d:225===c?(b.x=-d,b.y=-d):270===c?b.y=-d:315===c&&(b.x=a.naturalBounds.width+
d,b.y=-d);return a.ja(b)};sg.prototype.doDeactivate=function(){var a=this.diagram;this.stopTransaction();this.ue=this.handle=null;this.Xr=new K(NaN,NaN);this.isActive=a.isMouseCaptured=!1};sg.prototype.doCancel=function(){this.diagram.delaysLayout=!1;this.rotate(this.originalAngle);this.stopTool()};sg.prototype.doMouseMove=function(){var a=this.diagram;this.isActive&&(a=this.computeRotate(a.lastInput.documentPoint),this.rotate(a))};
sg.prototype.doMouseUp=function(){var a=this.diagram;if(this.isActive){a.delaysLayout=!1;var b=this.computeRotate(a.lastInput.documentPoint);this.rotate(b);a.Wa();this.transactionResult=this.name;a.V("PartRotated",this.adornedObject,this.originalAngle)}this.stopTool()};
sg.prototype.rotate=function(a){G&&E(a,sg,"rotate:newangle");var b=this.adornedObject;if(null!==b){b.angle=a;b=b.part;b.Ya();var c=b.locationObject,d=b.rotateObject;if(c===d||c.Dg(d))c=this.Vo.copy(),b.location=c.qe(this.rotationPoint).rotate(a-this.originalAngle).add(this.rotationPoint);this.diagram.od()}};
sg.prototype.computeRotate=function(a){a=this.rotationPoint.Va(a)-this.handleAngle;var b=this.adornedObject.panel;null!==b&&(a-=b.Vi());360<=a?a-=360:0>a&&(a+=360);b=Math.min(Math.abs(this.snapAngleMultiple),180);var c=Math.min(Math.abs(this.snapAngleEpsilon),b/2);!this.diagram.lastInput.shift&&0<b&&0<c&&(a%b<c?a=Math.floor(a/b)*b:a%b>b-c&&(a=(Math.floor(a/b)+1)*b));360<=a?a-=360:0>a&&(a+=360);return a};
na.Object.defineProperties(sg.prototype,{handleArchetype:{configurable:!0,get:function(){return this.o},set:function(a){null!==a&&w(a,O,sg,"handleArchetype");this.o=a}},handle:{configurable:!0,get:function(){return this.j},set:function(a){if(null!==a&&(w(a,O,sg,"handle"),!(a.part instanceof Ke)))throw Error("new handle is not in an Adornment: "+a);this.j=a}},adornedObject:{configurable:!0,get:function(){return this.ue},set:function(a){if(null!==a&&(w(a,O,
sg,"handle"),a.part instanceof Ke))throw Error("new handle must not be in an Adornment: "+a);this.ue=a}},snapAngleMultiple:{configurable:!0,get:function(){return this.Ha},set:function(a){A(a,"number",sg,"snapAngleMultiple");this.Ha=a}},snapAngleEpsilon:{configurable:!0,get:function(){return this.Da},set:function(a){A(a,"number",sg,"snapAngleEpsilon");this.Da=a}},originalAngle:{configurable:!0,get:function(){return this.ox}},rotationPoint:{configurable:!0,
enumerable:!0,get:function(){return this.Xr},set:function(a){this.Xr=a.copy()}},handleAngle:{configurable:!0,get:function(){return this.F},set:function(a){A(a,"number",sg,"handleAngle");this.F=a}},handleDistance:{configurable:!0,get:function(){return this.O},set:function(a){A(a,"number",sg,"handleDistance");this.O=a}}});sg.className="RotatingTool";Ua("rotatingTool",function(){return this.findTool("Rotating")},function(a){this.gb("Rotating",a,this.mouseDownTools)});
function tg(){ze.call(this);0<arguments.length&&Ca(tg);this.name="ClickSelecting"}ma(tg,ze);tg.prototype.canStart=function(){return!this.isEnabled||this.isBeyondDragSize()?!1:!0};tg.prototype.doMouseUp=function(){this.isActive&&(this.standardMouseSelect(),!this.standardMouseClick()&&this.diagram.lastInput.isTouchEvent&&this.diagram.toolManager.doToolTip());this.stopTool()};tg.className="ClickSelectingTool";function Gg(){ze.call(this);0<arguments.length&&Ca(Gg);this.name="Action";this.Fk=null}
ma(Gg,ze);Gg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram,b=a.lastInput,c=a.dc(b.documentPoint,function(a){for(;null!==a.panel&&!a.isActionable;)a=a.panel;return a});if(null!==c){if(!c.isActionable)return!1;this.Fk=c;a.Vk=a.dc(b.documentPoint,null,null);return!0}return!1};Gg.prototype.doMouseDown=function(){if(this.isActive){var a=this.diagram.lastInput,b=this.Fk;null!==b&&(a.targetObject=b,null!==b.actionDown&&b.actionDown(a,b))}else this.canStart()&&this.doActivate()};
Gg.prototype.doMouseMove=function(){if(this.isActive){var a=this.diagram.lastInput,b=this.Fk;null!==b&&(a.targetObject=b,null!==b.actionMove&&b.actionMove(a,b))}};Gg.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram.lastInput,b=this.Fk;if(null===b)return;a.targetObject=b;null!==b.actionUp&&b.actionUp(a,b);this.standardMouseClick(function(a){for(;null!==a.panel&&(!a.isActionable||a!==b);)a=a.panel;return a},function(a){return a===b})}this.stopTool()};
Gg.prototype.doCancel=function(){var a=this.diagram.lastInput,b=this.Fk;null!==b&&(a.targetObject=b,null!==b.actionCancel&&b.actionCancel(a,b),this.stopTool())};Gg.prototype.doStop=function(){this.Fk=null};Gg.className="ActionTool";function Hg(){ze.call(this);0<arguments.length&&Ca(Hg);this.name="ClickCreating";this.nj=null;this.o=!0;this.j=!1;this.Zw=new K(0,0)}ma(Hg,ze);
Hg.prototype.canStart=function(){if(!this.isEnabled||null===this.archetypeNodeData)return!1;var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.lastInput.left||this.isBeyondDragSize())return!1;if(this.isDoubleClick){if(1===a.lastInput.clickCount&&(this.Zw=a.lastInput.viewPoint.copy()),2!==a.lastInput.clickCount||this.isBeyondDragSize(this.Zw))return!1}else if(1!==a.lastInput.clickCount)return!1;return a.currentTool!==this&&null!==a.mm(a.lastInput.documentPoint,!0)?!1:!0};
Hg.prototype.doMouseUp=function(){var a=this.diagram;this.isActive&&this.insertPart(a.lastInput.documentPoint);this.stopTool()};
Hg.prototype.insertPart=function(a){var b=this.diagram,c=this.archetypeNodeData;if(null===c)return null;var d=null;try{b.V("ChangingSelection",b.selection);this.Ea(this.name);if(c instanceof U)c.Tc()&&(og(c),d=c.copy(),null!==d&&b.add(d));else if(null!==c){var e=b.model.copyNodeData(c);Ga(e)&&(b.model.Ef(e),d=b.Gc(e))}if(null!==d){var f=K.allocAt(a.x,a.y);this.isGridSnapEnabled&&Ig(this.diagram,d,a,f);d.location=f;b.allowSelect&&(b.clearSelection(!0),d.isSelected=!0);K.free(f)}b.Wa();this.transactionResult=
this.name;b.V("PartCreated",d)}finally{this.stopTransaction(),b.V("ChangedSelection",b.selection)}return d};
na.Object.defineProperties(Hg.prototype,{archetypeNodeData:{configurable:!0,get:function(){return this.nj},set:function(a){null!==a&&A(a,"object",Hg,"archetypeNodeData");this.nj=a}},isDoubleClick:{configurable:!0,get:function(){return this.o},set:function(a){A(a,"boolean",Hg,"isDoubleClick");this.o=a}},isGridSnapEnabled:{configurable:!0,get:function(){return this.j},set:function(a){A(a,"boolean",Hg,"isGridSnapEnabled");this.j=a}}});Hg.className="ClickCreatingTool";
function Jg(){ze.call(this);0<arguments.length&&Ca(Jg);this.name="DragSelecting";this.al=175;this.o=!1;var a=new U;a.layerName="Tool";a.selectable=!1;var b=new Kf;b.name="SHAPE";b.figure="Rectangle";b.fill=null;b.stroke="magenta";a.add(b);this.j=a}ma(Jg,ze);
Jg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(!a.allowSelect)return!1;var b=a.lastInput;return!b.left||a.currentTool!==this&&(!this.isBeyondDragSize()||b.timestamp-a.firstInput.timestamp<this.delay||null!==a.mm(b.documentPoint,!0))?!1:!0};Jg.prototype.doActivate=function(){var a=this.diagram;this.isActive=!0;a.isMouseCaptured=!0;a.skipsUndoManager=!0;a.add(this.box);this.doMouseMove()};
Jg.prototype.doDeactivate=function(){var a=this.diagram;a.Fg();a.remove(this.box);a.skipsUndoManager=!1;this.isActive=a.isMouseCaptured=!1};Jg.prototype.doMouseMove=function(){var a=this.diagram;if(this.isActive&&null!==this.box){var b=this.computeBoxBounds(),c=this.box.eb("SHAPE");null===c&&(c=this.box.ub());var d=Hb.alloc().h(b.width,b.height);c.desiredSize=d;this.box.Km(b.x,b.y,!1);Hb.free(d);(a.allowHorizontalScroll||a.allowVerticalScroll)&&a.zs(a.lastInput.viewPoint)}};
Jg.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram;a.remove(this.box);try{a.currentCursor="wait",a.V("ChangingSelection",a.selection),this.selectInRect(this.computeBoxBounds()),a.V("ChangedSelection",a.selection)}finally{a.currentCursor=""}}this.stopTool()};Jg.prototype.computeBoxBounds=function(){var a=this.diagram;return new M(a.firstInput.documentPoint,a.lastInput.documentPoint)};
Jg.prototype.selectInRect=function(a){var b=this.diagram,c=b.lastInput;a=b.gy(a,this.isPartialInclusion);if($a?c.meta:c.control)if(c.shift)for(a=a.iterator;a.next();)b=a.value,b.isSelected&&(b.isSelected=!1);else for(a=a.iterator;a.next();)b=a.value,b.isSelected=!b.isSelected;else if(c.shift)for(a=a.iterator;a.next();)b=a.value,b.isSelected||(b.isSelected=!0);else{c=new H;for(b=b.selection.iterator;b.next();){var d=b.value;a.contains(d)||c.add(d)}for(b=c.iterator;b.next();)b.value.isSelected=!1;for(a=
a.iterator;a.next();)b=a.value,b.isSelected||(b.isSelected=!0)}};na.Object.defineProperties(Jg.prototype,{delay:{configurable:!0,get:function(){return this.al},set:function(a){A(a,"number",Jg,"delay");this.al=a}},isPartialInclusion:{configurable:!0,get:function(){return this.o},set:function(a){A(a,"boolean",Jg,"isPartialInclusion");this.o=a}},box:{configurable:!0,get:function(){return this.j},set:function(a){null!==a&&w(a,U,Jg,"box");this.j=a}}});
Jg.className="DragSelectingTool";function Kg(){ze.call(this);0<arguments.length&&Ca(Kg);this.name="Panning";this.hu=new K;this.kz=new K;this.Jg=!1;var a=this;this.wx=function(){var b=a.diagram;null!==b&&b.removeEventListener(sa.document,"scroll",a.wx,!1);a.stopTool()}}ma(Kg,ze);Kg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return!a.allowHorizontalScroll&&!a.allowVerticalScroll||!a.lastInput.left||a.currentTool!==this&&!this.isBeyondDragSize()?!1:!0};
Kg.prototype.doActivate=function(){var a=this.diagram;this.Jg?(a.lastInput.bubbles=!0,a.addEventListener(sa.document,"scroll",this.wx,!1)):(a.currentCursor="move",a.isMouseCaptured=!0,this.hu.assign(a.position));this.isActive=!0};Kg.prototype.doDeactivate=function(){var a=this.diagram;a.currentCursor="";this.isActive=a.isMouseCaptured=!1};Kg.prototype.doCancel=function(){var a=this.diagram;a.position=this.hu;a.isMouseCaptured=!1;this.stopTool()};Kg.prototype.doMouseMove=function(){this.move()};
Kg.prototype.doMouseUp=function(){this.move();this.stopTool()};Kg.prototype.move=function(){var a=this.diagram;if(this.isActive&&a)if(this.Jg)a.lastInput.bubbles=!0;else{var b=a.position,c=a.firstInput.documentPoint,d=a.lastInput.documentPoint,e=b.x+c.x-d.x;c=b.y+c.y-d.y;a.allowHorizontalScroll||(e=b.x);a.allowVerticalScroll||(c=b.y);a.position=this.kz.h(e,c)}};
na.Object.defineProperties(Kg.prototype,{bubbles:{configurable:!0,get:function(){return this.Jg},set:function(a){A(a,"boolean",Kg,"bubbles");this.Jg=a}},originalPosition:{configurable:!0,get:function(){return this.hu}}});Kg.className="PanningTool";Ua("clickCreatingTool",function(){return this.findTool("ClickCreating")},function(a){this.gb("ClickCreating",a,this.mouseUpTools)});
Ua("clickSelectingTool",function(){return this.findTool("ClickSelecting")},function(a){this.gb("ClickSelecting",a,this.mouseUpTools)});Ua("panningTool",function(){return this.findTool("Panning")},function(a){this.gb("Panning",a,this.mouseMoveTools)});Ua("dragSelectingTool",function(){return this.findTool("DragSelecting")},function(a){this.gb("DragSelecting",a,this.mouseMoveTools)});Ua("actionTool",function(){return this.findTool("Action")},function(a){this.gb("Action",a,this.mouseDownTools)});
function Pe(){this.O=this.F=this.j=this.o=null}
na.Object.defineProperties(Pe.prototype,{mainElement:{configurable:!0,get:function(){return this.F},set:function(a){null!==a&&w(a,HTMLElement,Pe,"mainElement");this.F=a}},show:{configurable:!0,get:function(){return this.o},set:function(a){this.o!==a&&(null!==a&&A(a,"function",Pe,"show"),this.o=a)}},hide:{configurable:!0,get:function(){return this.j},set:function(a){this.j!==a&&(null!==a&&A(a,"function",Pe,"hide"),this.j=a)}},valueFunction:{configurable:!0,
enumerable:!0,get:function(){return this.O},set:function(a){this.O=a}}});Pe.className="HTMLInfo";function Lg(a,b,c){this.text=a;this.Rx=b;this.visible=c}Lg.className="ContextMenuButtonInfo";function Mg(){ze.call(this);0<arguments.length&&Ca(Mg);this.name="ContextMenu";this.o=this.Ht=this.j=null;this.kx=new K;this.It=null;this.Wt=!1;var a=this;this.zu=function(){a.stopTool()}}ma(Mg,ze);
function Ng(a){var b=new Pe;b.show=function(a,b,c){c.showDefaultContextMenu()};b.hide=function(a,b){b.hideDefaultContextMenu()};Og=b;a.zu=function(){a.stopTool()};b=wa("div");var c=wa("div");b.style.cssText="top: 0px;z-index:10002;position: fixed;display: none;text-align: center;left: 25%;width: 50%;background-color: #F5F5F5;padding: 16px;border: 16px solid #444;border-radius: 10px;margin-top: 10px";c.style.cssText="z-index:10001;position: fixed;display: none;top: 0;left: 0;width: 100%;height: 100%;background-color: black;opacity: 0.8;";
var d=wa("style");sa.document.getElementsByTagName("head")[0].appendChild(d);d.sheet.insertRule(".goCXul { list-style: none; }",0);d.sheet.insertRule(".goCXli {font:700 1.5em Helvetica, Arial, sans-serif;position: relative;min-width: 60px; }",0);d.sheet.insertRule(".goCXa {color: #444;display: inline-block;padding: 4px;text-decoration: none;margin: 2px;border: 1px solid gray;border-radius: 10px; }",0);d=a.diagram;null!==d&&(d.addEventListener(b,"contextmenu",Pg,!1),d.addEventListener(b,"selectstart",
Pg,!1),d.addEventListener(c,"contextmenu",Pg,!1));b.className="goCXforeground";c.className="goCXbackground";sa.document.body&&(sa.document.body.appendChild(b),sa.document.body.appendChild(c));Qg=b;Rg=c;Sg=!0}function Pg(a){a.preventDefault();return!1}
Mg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return this.isBeyondDragSize()||!a.lastInput.right||1<a.lastInput.clickCount?!1:a.lastInput.isTouchEvent&&null!==this.defaultTouchContextMenu||null!==this.findObjectWithContextMenu()?!0:!1};Mg.prototype.doStart=function(){this.kx.set(this.diagram.firstInput.documentPoint)};Mg.prototype.doStop=function(){this.hideContextMenu();this.currentObject=null};
Mg.prototype.findObjectWithContextMenu=function(a){void 0===a&&(a=null);var b=this.diagram,c=b.lastInput,d=null;a instanceof Q||(a instanceof O?d=a:d=b.dc(c.documentPoint,null,function(a){return!a.layer.isTemporary}));if(null!==d){for(a=d;null!==a;){if(null!==a.contextMenu)return a;a=a.panel}if(b.lastInput.isTouchEvent&&this.defaultTouchContextMenu)return d.part}else if(null!==b.contextMenu)return b;return null};Mg.prototype.doActivate=function(){};
Mg.prototype.doMouseDown=function(){ze.prototype.doMouseDown.call(this);if(this.isActive&&this.currentContextMenu instanceof Ke){var a=this.diagram.toolManager.findTool("Action");null!==a&&a.canStart()&&(a.doActivate(),a.doMouseDown(),a.doDeactivate())}this.diagram.toolManager.mouseDownTools.contains(this)&&Tg(this)};
Mg.prototype.doMouseUp=function(){if(this.isActive&&this.currentContextMenu instanceof Ke){var a=this.diagram.toolManager.findTool("Action");null!==a&&a.canStart()&&(a.doActivate(),a.doCancel(),a.doDeactivate())}Tg(this)};
function Tg(a){var b=a.diagram;if(a.isActive){var c=a.currentContextMenu;if(null!==c){if(!(c instanceof Pe)){var d=b.dc(b.lastInput.documentPoint,null,null);null!==d&&d.Dg(c)&&a.standardMouseClick(null,null)}a.stopTool();a.canStart()&&(b.currentTool=a,a.doMouseUp())}}else a.canStart()&&(Ug(a,!0),a.isActive||a.stopTool())}
function Ug(a,b,c){void 0===c&&(c=null);if(!a.Wt&&(a.Wt=!0,b&&a.standardMouseSelect(),b=a.standardMouseClick(),a.Wt=!1,!b)){a.isActive=!0;b=Og;null===c&&(c=a.findObjectWithContextMenu());if(null!==c){var d=c.contextMenu;null!==d?(a.currentObject=c instanceof O?c:null,a.showContextMenu(d,a.currentObject)):null!==b&&a.showContextMenu(b,a.currentObject)}else null!==b&&a.showContextMenu(b,null);a.currentContextMenu instanceof Ke&&!a.currentContextMenu.visible&&a.stopTool()}}
Mg.prototype.doMouseMove=function(){var a=this.diagram.toolManager.findTool("Action");null!==a&&a.doMouseMove();this.isActive&&this.diagram.toolManager.doMouseMove()};
Mg.prototype.showContextMenu=function(a,b){!G||a instanceof Ke||a instanceof Pe||v("showContextMenu:contextMenu must be an Adornment or HTMLInfo.");null!==b&&w(b,O,Mg,"showContextMenu:obj");var c=this.diagram;a!==this.currentContextMenu&&this.hideContextMenu();if(a instanceof Ke){a.layerName="Tool";a.selectable=!1;a.scale=1/c.scale;a.category=this.name;null!==a.placeholder&&(a.placeholder.scale=c.scale);var d=a.diagram;null!==d&&d!==c&&d.remove(a);c.add(a);null!==b?a.adornedObject=b:a.data=c.model;
a.Ya();this.positionContextMenu(a,b)}else a instanceof Pe&&a.show(b,c,this);this.currentContextMenu=a};Mg.prototype.positionContextMenu=function(a){if(null===a.placeholder){var b=this.diagram,c=b.lastInput.documentPoint.copy(),d=a.measuredBounds,e=b.viewportBounds;b.lastInput.isTouchEvent&&(c.x-=d.width);c.x+d.width>e.right&&(c.x-=d.width+5/b.scale);c.x<e.x&&(c.x=e.x);c.y+d.height>e.bottom&&(c.y-=d.height+5/b.scale);c.y<e.y&&(c.y=e.y);a.position=c}};
Mg.prototype.hideContextMenu=function(){var a=this.diagram,b=this.currentContextMenu;null!==b&&(b instanceof Ke?(a.remove(b),null!==this.Ht&&this.Ht.Sf(b.category),b.data=null,b.adornedObject=null):b instanceof Pe&&(null!==b.hide?b.hide(a,this):null!==b.mainElement&&(b.mainElement.style.display="none")),this.currentContextMenu=null,this.standardMouseOver())};
function Vg(a){var b=new H;b.add(new Lg("Copy",function(a){a.commandHandler.copySelection()},function(a){return a.commandHandler.canCopySelection()}));b.add(new Lg("Cut",function(a){a.commandHandler.cutSelection()},function(a){return a.commandHandler.canCutSelection()}));b.add(new Lg("Delete",function(a){a.commandHandler.deleteSelection()},function(a){return a.commandHandler.canDeleteSelection()}));b.add(new Lg("Paste",function(b){b.commandHandler.pasteSelection(a.mouseDownPoint)},function(b){return b.commandHandler.canPasteSelection(a.mouseDownPoint)}));
b.add(new Lg("Select All",function(a){a.commandHandler.selectAll()},function(a){return a.commandHandler.canSelectAll()}));b.add(new Lg("Undo",function(a){a.commandHandler.undo()},function(a){return a.commandHandler.canUndo()}));b.add(new Lg("Redo",function(a){a.commandHandler.redo()},function(a){return a.commandHandler.canRedo()}));b.add(new Lg("Scroll To Part",function(a){a.commandHandler.scrollToPart()},function(a){return a.commandHandler.canScrollToPart()}));b.add(new Lg("Zoom To Fit",function(a){a.commandHandler.zoomToFit()},
function(a){return a.commandHandler.canZoomToFit()}));b.add(new Lg("Reset Zoom",function(a){a.commandHandler.resetZoom()},function(a){return a.commandHandler.canResetZoom()}));b.add(new Lg("Group Selection",function(a){a.commandHandler.groupSelection()},function(a){return a.commandHandler.canGroupSelection()}));b.add(new Lg("Ungroup Selection",function(a){a.commandHandler.ungroupSelection()},function(a){return a.commandHandler.canUngroupSelection()}));b.add(new Lg("Edit Text",function(a){a.commandHandler.editTextBlock()},
function(a){return a.commandHandler.canEditTextBlock()}));return b}
Mg.prototype.showDefaultContextMenu=function(){var a=this.diagram;null===this.It&&(this.It=Vg(this));Qg.innerHTML="";Rg.addEventListener("pointerdown",this.zu,!1);var b=this,c=wa("ul");c.className="goCXul";Qg.appendChild(c);c.innerHTML="";for(var d=this.It.iterator;d.next();){var e=d.value,f=e.visible;if("function"===typeof e.Rx&&("function"!==typeof f||f(a))){f=wa("li");f.className="goCXli";var g=wa("a");g.className="goCXa";g.href="#";g.Zy=e.Rx;g.addEventListener("pointerdown",function(c){this.Zy(a);
b.stopTool();c.preventDefault();return!1},!1);g.textContent=e.text;f.appendChild(g);c.appendChild(f)}}Qg.style.display="block";Rg.style.display="block"};Mg.prototype.hideDefaultContextMenu=function(){if(null!==this.currentContextMenu&&this.currentContextMenu===Og){Qg.style.display="none";Rg.style.display="none";var a=this.diagram;null!==a&&a.removeEventListener(Rg,"pointerdown",this.zu,!1);this.currentContextMenu=null}};
na.Object.defineProperties(Mg.prototype,{currentContextMenu:{configurable:!0,get:function(){return this.j},set:function(a){!G||null===a||a instanceof Ke||a instanceof Pe||v("ContextMenuTool.currentContextMenu must be an Adornment or HTMLInfo.");this.j=a;this.Ht=a instanceof Ke?a.adornedPart:null}},defaultTouchContextMenu:{configurable:!0,get:function(){!1===Sg&&null===Og&&Wg&&Ng(this);return Og},set:function(a){!G||null===a||a instanceof Ke||a instanceof Pe||v("ContextMenuTool.defaultTouchContextMenu must be an Adornment or HTMLInfo.");
null===a&&(Sg=!0);Og=a}},currentObject:{configurable:!0,get:function(){return this.o},set:function(a){null!==a&&w(a,O,Mg,"currentObject");this.o=a}},mouseDownPoint:{configurable:!0,get:function(){return this.kx}}});var Og=null,Sg=!1,Rg=null,Qg=null;Mg.className="ContextMenuTool";Ua("contextMenuTool",function(){return this.findTool("ContextMenu")},function(a){this.gb("ContextMenu",a,this.mouseUpTools)});
function Xg(){0<arguments.length&&Ca(Xg);ze.call(this);this.name="TextEditing";this.Bh=new Yg;this.Ha=null;this.Da=Zg;this.Fi=null;this.oa=$g;this.F=1;this.O=!0;this.o=null;this.j=new Pe;this.Jt=null;ah(this,this.j)}ma(Xg,ze);
function ah(a,b){if(Wg){var c=wa("textarea");a.Jt=c;c.addEventListener("input",function(){if(null!==a.textBlock){var b=a.zy(this.value);this.style.width=20+b.measuredBounds.width*this.kB+"px";this.rows=b.lineCount}},!1);c.addEventListener("keydown",function(b){if(null!==a.textBlock){var c=b.key;"Enter"===c?(!1===a.textBlock.isMultiline&&b.preventDefault(),a.acceptText(bh)):"Tab"===c?(a.acceptText(ch),b.preventDefault()):"Escape"===c&&(a.doCancel(),null!==a.diagram&&a.diagram.doFocus())}},!1);c.addEventListener("focus",
function(){if(null!==a.currentTextEditor&&a.state!==$g){var b=a.Jt;a.oa===dh&&(a.oa=eh);"function"===typeof b.select&&a.selectsTextOnActivate&&(b.select(),b.setSelectionRange(0,9999))}},!1);c.addEventListener("blur",function(){if(null!==a.currentTextEditor&&a.state!==$g){var b=a.Jt;"function"===typeof b.focus&&b.focus();"function"===typeof b.select&&a.selectsTextOnActivate&&(b.select(),b.setSelectionRange(0,9999))}},!1);b.valueFunction=function(){return c.value};b.mainElement=c;b.show=function(a,
b,f){if(a instanceof Yg&&f instanceof Xg)if(f.state===fh)c.style.border="3px solid red",c.focus();else{var d=a.ja(Ic),e=b.position,k=b.scale,l=a.Mf()*k;l<f.minimumEditorScale&&(l=f.minimumEditorScale);var m=a.naturalBounds.width*l+6,n=a.naturalBounds.height*l+2,p=(d.x-e.x)*k;d=(d.y-e.y)*k;e=a.verticalAlignment;k=(a.lineHeight+a.spacingAbove+a.spacingBelow)*a.lineCount*l;n=e.y*n-e.y*k+e.offsetY-(.5*n-.5*k)-k/2;c.value=a.text;b.div.style.font=a.font;c.style.position="absolute";c.style.zIndex="100";
c.style.font="inherit";c.style.fontSize=100*l+"%";c.style.lineHeight="normal";c.style.width=m+"px";c.style.left=(p-m/2|0)-1+"px";c.style.top=(d+n|0)-1+"px";c.style.textAlign=a.textAlign;c.style.margin="0";c.style.padding="1px";c.style.border="0";c.style.outline="none";c.style.whiteSpace="pre-wrap";c.style.overflow="hidden";c.rows=a.lineCount;c.kB=l;c.className="goTXarea";b.div.appendChild(c);c.focus();f.selectsTextOnActivate&&(c.select(),c.setSelectionRange(0,9999))}};b.hide=function(a){a.div.removeChild(c)}}}
Xg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(null===a||a.isReadOnly||gh&&gh!==this&&(gh.acceptText(hh),gh&&gh!==this)||!a.lastInput.left||this.isBeyondDragSize())return!1;var b=a.dc(a.lastInput.documentPoint);if(!(null!==b&&b instanceof Yg&&b.editable&&b.part.canEdit()))return!1;b=b.part;return null===b||this.starting===Zg&&!b.isSelected||this.starting===ih&&2>a.lastInput.clickCount?!1:!0};Xg.prototype.doStart=function(){gh=this;null!==this.textBlock&&this.doActivate()};
Xg.prototype.doActivate=function(){if(!this.isActive){var a=this.diagram;if(null!==a){var b=this.textBlock;null===b&&(b=a.dc(a.lastInput.documentPoint));if(null!==b&&b instanceof Yg&&(this.textBlock=b,null!==b.part)){a.animationManager.wc();this.isActive=!0;this.oa=dh;var c=this.defaultTextEditor;null!==b.textEditor&&(c=b.textEditor);this.Bh=this.textBlock.copy();var d=new M(this.textBlock.ja(Cc),this.textBlock.ja(Nc));a.Tv(d);c.show(b,a,this);this.currentTextEditor=c}}}};Xg.prototype.doCancel=function(){this.stopTool()};
Xg.prototype.doMouseUp=function(){this.canStart()&&this.doActivate()};Xg.prototype.doMouseDown=function(){this.isActive&&this.acceptText(hh)};Xg.prototype.acceptText=function(a){switch(a){case hh:if(this.oa===jh)this.currentTextEditor instanceof HTMLElement&&this.currentTextEditor.focus();else if(this.oa===dh||this.oa===fh||this.oa===eh)this.oa=kh,lh(this);break;case mh:case bh:case ch:if(bh!==a||!0!==this.textBlock.isMultiline)if(this.oa===dh||this.oa===fh||this.oa===eh)this.oa=kh,lh(this)}};
function lh(a){var b=a.textBlock,c=a.diagram,d=a.currentTextEditor;if(null!==b&&null!==d){var e=b.text,f="";null!==d.valueFunction&&(f=d.valueFunction());a.isValidText(b,e,f)?(a.Ea(a.name),a.oa=jh,a.transactionResult=a.name,b.text=f,a.doSuccess(e,f),null!==c&&c.V("TextEdited",b,e),a.stopTransaction(),a.stopTool(),null!==c&&c.doFocus()):(a.oa=fh,a.doError(e,f))}}
Xg.prototype.doError=function(a,b){var c=this.textBlock;null!==c.errorFunction&&c.errorFunction(this,a,b);(a=this.currentTextEditor)&&a.show(c,this.diagram,this)};Xg.prototype.doSuccess=function(a,b){var c=this.textBlock;null!==c.textEdited&&c.textEdited(c,a,b)};Xg.prototype.doDeactivate=function(){var a=this.diagram;null!==a&&(this.oa=$g,null!==this.currentTextEditor&&this.currentTextEditor.hide(a,this),this.textBlock=null,this.isActive=!1)};Xg.prototype.doStop=function(){gh=null};
Xg.prototype.isValidText=function(a,b,c){w(a,Yg,Xg,"isValidText:textblock");var d=this.textValidation;if(null!==d&&!d(a,b,c))return!1;d=a.textValidation;return null===d||d(a,b,c)?!0:!1};Xg.prototype.zy=function(a){var b=this.Bh;b.text=a;b.measure(this.textBlock.pi,Infinity);return b};
na.Object.defineProperties(Xg.prototype,{textBlock:{configurable:!0,get:function(){return this.Ha},set:function(a){null!==a&&w(a,Yg,Xg,"textBlock");this.Ha=a}},currentTextEditor:{configurable:!0,get:function(){return this.o},set:function(a){this.o=a}},defaultTextEditor:{configurable:!0,get:function(){return this.j},set:function(a){!G||a instanceof Pe||v("TextEditingTool.defaultTextEditor must be an HTMLInfo.");this.j=a}},starting:{configurable:!0,
get:function(){return this.Da},set:function(a){db(a,Xg,Xg,"starting");this.Da=a}},textValidation:{configurable:!0,get:function(){return this.Fi},set:function(a){null!==a&&A(a,"function",Xg,"textValidation");this.Fi=a}},minimumEditorScale:{configurable:!0,get:function(){return this.F},set:function(a){null!==a&&A(a,"number",Xg,"minimumEditorScale");this.F=a}},selectsTextOnActivate:{configurable:!0,get:function(){return this.O},set:function(a){null!==a&&A(a,
"boolean",Xg,"selectsTextOnActivate");this.O=a}},state:{configurable:!0,get:function(){return this.oa},set:function(a){this.oa!==a&&(db(a,Xg,Xg,"starting"),this.oa=a)}}});Xg.prototype.measureTemporaryTextBlock=Xg.prototype.zy;
var mh=new F(Xg,"LostFocus",0),hh=new F(Xg,"MouseDown",1),ch=new F(Xg,"Tab",2),bh=new F(Xg,"Enter",3),nh=new F(Xg,"SingleClick",0),Zg=new F(Xg,"SingleClickSelected",1),ih=new F(Xg,"DoubleClick",2),$g=new F(Xg,"StateNone",0),dh=new F(Xg,"StateActive",1),eh=new F(Xg,"StateEditing",2),kh=new F(Xg,"StateValidating",3),fh=new F(Xg,"StateInvalid",4),jh=new F(Xg,"StateValidated",5),gh=null;Xg.className="TextEditingTool";Xg.LostFocus=mh;Xg.MouseDown=hh;Xg.Tab=ch;Xg.Enter=bh;Xg.SingleClick=nh;
Xg.SingleClickSelected=Zg;Xg.DoubleClick=ih;Xg.StateNone=$g;Xg.StateActive=dh;Xg.StateEditing=eh;Xg.StateValidating=kh;Xg.StateInvalid=fh;Xg.StateValidated=jh;Ua("textEditingTool",function(){return this.findTool("TextEditing")},function(a){this.gb("TextEditing",a,this.mouseUpTools)});
function oh(a){ph||(qh(),ph=!0);this.D=Ge;this.jl=this.yb=this.Dr=this.qc=!1;this.Cx=!0;this.kl=rh;this.fn=!1;this.ki=this.Cd=!0;this.Wg=600;this.Pw=this.Ax=!1;this.df=new I;this.Yd=new sh;this.Yd.Vd=this;this.mj=new I;this.vu=new I;this.qs=new I;this.Ll=new I;a&&Object.assign(this,a)}oh.prototype.$e=function(a){this.D=a};oh.prototype.canStart=function(){return!0};function th(a,b){a.Cd&&a.canStart(b)&&(a.df.add(b),a.defaultAnimation.isAnimating&&a.wc(),uh(a.D),a.yb=!0)}
function vh(a){if(a.Cd&&a.yb){var b=a.Yd,c=a.D,d=a.df.contains("Model");d&&(a.jl=!0,a.kl===rh?(b.isViewportUnconstrained=!0,b.sc.clear(),b.add(c,"position",c.position.copy().offset(0,-200),c.position),b.add(c,"opacity",0,1)):a.kl===wh&&b.sc.clear(),a.Cx=a.kl===xh&&c.nu.B(c.pa)?!0:!1,c.V("InitialAnimationStarting",a));d&&!a.ki||0===b.sc.count?(a.df.clear(),a.yb=!1,b.sc.clear(),yh(b,c),a.jl=!1,c.R()):(a.df.clear(),c.vg=!1,d=b.sc.get(c),c.autoScale!==zh&&null!==d&&(delete d.start.scale,delete d.end.scale),
sa.requestAnimationFrame(function(){!1===a.yb||b.qc||(c.Ve("temporaryPixelRatio")&&$e(c),Ah(c),a.yb=!1,b.start(),Bh(a),c.Wa(),Ch(b,0),Hf(c,!0),Dh(a),c.V("AnimationStarting",a))}))}}function Qh(a,b,c,d){a.isTicking||b instanceof R&&(null!==b.fromNode||null!==b.toNode)||a.Yd.add(b,"position",c,d,!1)}t=oh.prototype;t.Ys=function(a){return this.Yd.Ys(a)};t.rv=function(a){return this.Yd.rv(a)};
function Rh(a,b){function c(){0<e.qs.count&&(d.addAll(e.qs),e.qs.clear(),e.qc=!0);if(!1!==e.qc&&0!==d.count){e.vu.addAll(d);for(var a=e.vu.iterator;a.next();){var b=a.value;if(!1!==b.qc){a:if(0<b.bm.count)var h=!0;else{for(h=b.sc.iterator;h.next();){var k=h.key;if(k instanceof O&&null!==k.diagram||k instanceof Q){h=!0;break a}}h=!1}h?Sh(b,!1):b.rl=!0}}e.vu.clear();Bh(e);Hf(e.D);Dh(e);sa.requestAnimationFrame(c)}}var d=a.mj,e=a;a.qc?a.qs.add(b):(a.qc=!0,d.add(b),sa.requestAnimationFrame(function(){c()}))}
function Th(a){for(a=a.mj.iterator;a.next();)a.value.rl=!1}function Bh(a){if(!a.Dr){var b=a.D;a.Ax=b.skipsUndoManager;a.Pw=b.skipsModelSourceBindings;b.skipsUndoManager=!0;b.skipsModelSourceBindings=!0;a.Dr=!0}}function Dh(a){var b=a.D;b.skipsUndoManager=a.Ax;b.skipsModelSourceBindings=a.Pw;a.Dr=!1}
t.wc=function(a){var b=this.Yd;!0===this.yb&&(this.jl=this.yb=!1,this.df.clear(),0<b.sc.count&&this.D.Lb());if(this.qc){if(b.km(!0),b.sc.clear(),yh(b,null),!0===a)for(a=this.mj.Fa(),b=0;b<a.length;b++)a[b].km(!0)}else b.sc.clear(),yh(b,this.D)};t.km=function(a){a===this.defaultAnimation&&this.defaultAnimation.sc.clear();this.mj.remove(a);0===this.mj.count&&(this.qc=!1,this.D.Lb());a===this.defaultAnimation&&(this.defaultAnimation.sc.clear(),this.D.V("AnimationFinished",this))};
t.Yj=function(a,b){this.yb&&(this.df.contains("Expand Tree")||this.df.contains("Expand SubGraph"))&&(this.Yd.Yj(a,b),Uh(this,a))};t.Wj=function(a,b){this.yb&&(this.df.contains("Collapse Tree")||this.df.contains("Collapse SubGraph"))&&(this.Yd.Wj(a,b),Vh(this.Yd,b,"position",b.position,b.position),Uh(this,a))};function Wh(a,b,c){a.yb&&!b.B(c)&&(a.D.$i||(b=c.copy()),Vh(a.Yd,a.D,"position",b,c))}
function Uh(a,b){for(b=b.findLinksConnected();b.next();){var c=b.value;c.uf=c.points.copy();a.Ll.add(c)}}function Xh(a,b,c,d,e){null===a&&(a=[0,0,0,0]);null===b&&(b=[0,0,0,0]);var f=a[0],g=a[1],h=a[2];a=a[3];var k=b[0],l=b[1],m=b[2];b=b[3];if(0===h||100===h)f=k,g=l;else if(0===m||100===m)k=f,l=g;180<Math.abs(k-f)&&(k>f?f+=360:k+=360);f=e(c,f,k-f,d)%360;g=e(c,g,l-g,d);h=e(c,h,m-h,d);c=e(c,a,b-a,d);return"hsla("+f+", "+g+"%, "+h+"%, "+c+")"}
function qh(){function a(a,b,e,f,g,h){a.position=new K(f(g,b.x,e.x-b.x,h),f(g,b.y,e.y-b.y,h))}var b=new yb;b.add("position:diagram",a);b.add("position",a);b.add("position:part",function(a,b,e,f,g,h){g<h?a.Km(f(g,b.x,e.x-b.x,h),f(g,b.y,e.y-b.y,h),!1):a.position=new K(f(g,b.x,e.x-b.x,h),f(g,b.y,e.y-b.y,h))});b.add("location",function(a,b,e,f,g,h){g<h?a.Km(f(g,b.x,e.x-b.x,h),f(g,b.y,e.y-b.y,h),!0):a.location=new K(f(g,b.x,e.x-b.x,h),f(g,b.y,e.y-b.y,h))});b.add("position:placeholder",function(a,b,e,f,
g,h){g<h?a.Km(f(g,b.x,e.x-b.x,h),f(g,b.y,e.y-b.y,h),!1):a.position=new K(f(g,b.x,e.x-b.x,h),f(g,b.y,e.y-b.y,h))});b.add("position:nodeCollapse",function(a,b,e,f,g,h){var c=a.actualBounds,d=e.actualBounds;e=d.x+d.width/2-c.width/2;c=d.y+d.height/2-c.height/2;g<h?a.Km(f(g,b.x,e-b.x,h),f(g,b.y,c-b.y,h),!1):a.position=new K(f(g,b.x,e-b.x,h),f(g,b.y,c-b.y,h))});b.add("desiredSize",function(a,b,e,f,g,h){a.desiredSize=new M(f(g,b.width,e.width-b.width,h),f(g,b.height,e.height-b.height,h))});b.add("width",
function(a,b,e,f,g,h){a.width=f(g,b,e-b,h)});b.add("height",function(a,b,e,f,g,h){a.height=f(g,b,e-b,h)});b.add("fill",function(a,b,e,f,g,h){a.fill=Xh(b,e,g,h,f)});b.add("stroke",function(a,b,e,f,g,h){a.stroke=Xh(b,e,g,h,f)});b.add("strokeWidth",function(a,b,e,f,g,h){a.strokeWidth=f(g,b,e-b,h)});b.add("strokeDashOffset",function(a,b,e,f,g,h){a.strokeDashOffset=f(g,b,e-b,h)});b.add("background",function(a,b,e,f,g,h){a.background=Xh(b,e,g,h,f)});b.add("areaBackground",function(a,b,e,f,g,h){a.areaBackground=
Xh(b,e,g,h,f)});b.add("opacity",function(a,b,e,f,g,h){a.opacity=f(g,b,e-b,h)});b.add("scale",function(a,b,e,f,g,h){a.scale=f(g,b,e-b,h)});b.add("angle",function(a,b,e,f,g,h){a.angle=f(g,b,e-b,h)});Yh=b}
na.Object.defineProperties(oh.prototype,{animationReasons:{configurable:!0,get:function(){return this.df}},isEnabled:{configurable:!0,get:function(){return this.Cd},set:function(a){A(a,"boolean",oh,"isEnabled");(this.Cd=a)&&this.mj.each(function(a){a.isAnimating||Infinity!==a.runCount||a.start()})}},duration:{configurable:!0,get:function(){return this.Wg},set:function(a){A(a,"number",oh,"duration");1>a&&Ba(a,">= 1",oh,"duration");this.Wg=a}},isAnimating:{configurable:!0,
enumerable:!0,get:function(){return this.qc}},isTicking:{configurable:!0,get:function(){return this.Dr}},isInitial:{configurable:!0,get:function(){return this.ki},set:function(a){A(a,"boolean",oh,"isInitial");this.ki=a}},defaultAnimation:{configurable:!0,get:function(){return this.Yd}},activeAnimations:{configurable:!0,get:function(){return this.mj}},initialAnimationStyle:{configurable:!0,get:function(){return this.kl},set:function(a){G&&
db(a,oh,oh,"initialAnimationStyle");this.kl=a}}});oh.prototype.stopAnimation=oh.prototype.wc;var Yh=null,ph=!1,rh=new F(oh,"Default",1),xh=new F(oh,"AnimateLocations",2),wh=new F(oh,"None",3);oh.className="AnimationManager";oh.defineAnimationEffect=function(a,b){ph||(qh(),ph=!0);Yh.add(a,b)};oh.Default=rh;oh.AnimateLocations=xh;oh.None=wh;
function sh(a){this.Au=this.zx=this.Vd=this.D=null;this.rl=this.qc=this.j=!1;this.Kn=this.Jd=0;this.br=this.Nt=Zh;this.ql=this.kp=!1;this.mu=1;this.ku=0;this.Bd=this.Wg=NaN;this.Tw=0;this.Ln=null;this.o=zb;this.sc=new yb;this.fu=new yb;this.bm=new I;this.gu=new I;this.Qw=$h;a&&Object.assign(this,a)}sh.prototype.suspend=function(){this.rl=!0};sh.prototype.advanceTo=function(a,b){b&&(this.rl=!1);this.kp&&a>=this.Bd&&(this.ql=!0,a-=this.Bd);this.Tw=a;Sh(this,!0);Bh(this.Vd);Hf(this.D);Dh(this.Vd);this.D.redraw()};
function yh(a,b){a.fu.clear();a.ql=!1;a.ku=0;a.Bd=NaN;0<a.bm.count&&a.bm.clear();0<a.gu.count&&a.gu.clear();if(null!==b)for(a=b.links;a.next();)a.value.uf=null}t=sh.prototype;
t.start=function(){if(0===this.sc.count||this.qc)return this;for(var a=this.D,b=this.sc.iterator;b.next();){var c=b.value.end,d=b.key;if(c["position:placeholder"]){var e=d.findVisibleNode();if(e instanceof yf&&null!==e.placeholder){var f=e.placeholder;e=f.ja(Cc);f=f.padding;e.x+=f.left;e.y+=f.top;c["position:placeholder"]=e}}null===a&&(d instanceof Q?a=d:d instanceof O&&(a=d.diagram))}if(null!==a)this.D=a,this.Vd=a.animationManager;else return this;b=this.Vd;if(!1===b.isEnabled)return this;this.Bd=
isNaN(this.Wg)?b.duration:this.Wg;this.br=this.Nt;b.jl&&b.kl===rh&&this===b.defaultAnimation&&(this.br=ai,this.Bd=isNaN(this.Wg)?600===b.duration?900:b.duration:this.Wg);this.Qw=a.scrollMode;this.isViewportUnconstrained&&(a.Sj=bi);Bh(b);this.bm.each(function(b){b.data=null;a.add(b)});Dh(b);this.qc=!0;this.Jd=+new Date;this.Kn=this.Jd+this.Bd;Rh(b,this);return this};
t.uz=function(a,b){if(!a.Tc())return this;G&&(void 0===b&&v("addTemporaryPart: Required Diagram argument missing"),a.diagram===b&&v("addTemporaryPart: Part already in Diagram, did you mean to pass in a copy?"),null!==this.D&&this.D!==b&&v("addTemporaryPart: A different Diagram is already associated with this Animation: "+this.D.toString()));this.bm.add(a);this.D=b;return this};
t.add=function(a,b,c,d,e){if("position"===b&&c.B(d))return this;null===this.D&&(a instanceof Q?this.D=a:a instanceof O&&null!==a.diagram&&(this.D=a.diagram));if(a instanceof U){if(!a.isAnimated)return this;"position"===b&&(b="position:part")}Vh(this,a,b,c,d,e);return this};
function Vh(a,b,c,d,e,f){var g=a.sc;b instanceof Q&&"position"===c&&(c="position:diagram");if("fill"===c||"stroke"===c||"background"===c||"areaBackground"===c)ci(d),di(),d=[ei.j,ei.F,ei.o,ei.O],ci(e),di(),e=[ei.j,ei.F,ei.o,ei.O];if(g.contains(b)){var h=g.K(b);var k=h.start;var l=h.end;void 0===k[c]&&(k[c]=fi(d));l[c]=fi(e)}else k={},l={},k[c]=fi(d),l[c]=fi(e),h=k.position,b instanceof O&&h instanceof K&&!h.s()&&b.diagram.animationManager.df.contains("Expand SubGraph")&&h.assign(l.position),h=new gi(k,
l,f),g.add(b,h);g=k[c];g instanceof K&&!g.s()&&g.assign(a.o);f&&0===c.indexOf("position:")&&b instanceof U?h.$u.location=fi(b.location):f&&(h.$u[c]=fi(d))}function fi(a){return a instanceof K?a.copy():a instanceof Hb?a.copy():a}t.Ys=function(a){if(!this.qc)return!1;a=this.sc.K(a);return null!==a&&a.Mv};t.rv=function(a){if(!this.qc)return!1;a=this.sc.K(a);return null!==a&&(a.start.position||a.start.location)};
function Sh(a,b){if(!a.rl||b){var c=a.Vd;if(!1!==a.qc){var d=+new Date,e=d>a.Kn?a.Bd:d-a.Jd;b&&(e=a.Tw,e<a.Bd?(a.Jd=+new Date-e,a.Kn=a.Jd+a.Bd):e=a.Bd);Bh(c);Ch(a,e);Hf(a.D,!0);Dh(c);d>a.Kn&&(a.kp&&!a.ql?(a.Jd=+new Date,a.Kn=a.Jd+a.Bd,a.ql=!0):a.km(!1))}}}
function Ch(a,b){for(var c=a.Bd,d=a.sc.iterator,e=a.ql;d.next();){var f=d.key;if(!(f instanceof O&&null===f.diagram)){var g=d.value,h=e?g.end:g.start;g=e?g.start:g.end;var k=Yh,l;for(l in g)"position"===l&&(g["position:placeholder"]||g["position:nodeCollapse"])||null===k.get(l)||k.get(l)(f,h[l],g[l],a.br,b,c,a)}}}t.stop=function(){if(!this.qc)return this;this.km(!0);return this};
t.km=function(a){null!==this.Au&&this.Au.rp.remove(this.zx);if(this.qc){var b=this.D,c=this.Vd;this.rl=this.qc=c.jl=!1;Bh(c);for(var d=this.sc,e=this.bm.iterator;e.next();)b.remove(e.value);for(e=this.gu.iterator;e.next();)e.value.v();e=this.kp;d=d.iterator;for(var f=Yh;d.next();){var g=d.key,h=d.value,k=e?h.end:h.start,l=e?h.start:h.end,m=h.$u,n;for(n in l)if(null!==f.get(n)){var p=n;!h.Qu||"position:nodeCollapse"!==p&&"position:placeholder"!==p||(p="position");f.get(p)(g,k[n],void 0!==m[n]?m[n]:
h.Qu?k[n]:l[n],this.br,this.Bd,this.Bd,this)}h.Qu&&void 0!==m.location&&g instanceof U&&(g.location=m.location);h.Mv&&g instanceof U&&g.Tb(!1)}b.Ts.clear();kf(b,!1);b.Wa();b.R();Hf(b,!0);if(c.defaultAnimation===this){for(n=c.Ll.iterator;n.next();)e=n.value,null!==e.uf&&(e.points=e.uf,e.uf=null);c.Ll.clear()}this.isViewportUnconstrained&&(b.scrollMode=this.Qw);Dh(c);this.ku++;!a&&this.mu>this.ku?(this.ql=!1,this.start()):(this.Ln&&this.Ln(this),yh(this,null),c.km(this),b.Lb())}};
t.Yj=function(a,b){var c=b.actualBounds,d=null;b instanceof yf&&(d=b.placeholder);null!==d?(c=d.ja(Cc),d=d.padding,c.x+=d.left,c.y+=d.top,this.add(a,"position",c,a.position,!1)):this.add(a,"position",new K(c.x+c.width/2,c.y+c.height/2),a.position,!1);this.add(a,"scale",.01,a.scale,!1);if(a instanceof yf)for(a=a.memberParts;a.next();)d=a.value,d instanceof V&&this.Yj(d,b)};
t.Wj=function(a,b){if(a.isVisible()){var c=null;b instanceof yf&&(c=b.placeholder);null!==c?this.add(a,"position:placeholder",a.position,c,!0):this.add(a,"position:nodeCollapse",a.position,b,!0);this.add(a,"scale",a.scale,.01,!0);c=this.sc;c.contains(a)&&(c.K(a).Mv=!0);if(a instanceof yf)for(a=a.memberParts;a.next();)c=a.value,c instanceof V&&this.Wj(c,b)}};t.uA=function(a){var b=this.fu.get(a);null===b&&(b={},this.fu.add(a,b));return b};
na.Object.defineProperties(sh.prototype,{duration:{configurable:!0,get:function(){return this.Wg},set:function(a){A(a,"number",sh,"duration");1>a&&Ba(a,">= 1",sh,"duration");this.Wg=a}},reversible:{configurable:!0,get:function(){return this.kp},set:function(a){this.kp=a}},runCount:{configurable:!0,get:function(){return this.mu},set:function(a){0<a?this.mu=a:v("Animation.runCount value must be a positive integer.")}},finished:{configurable:!0,
get:function(){return this.Ln},set:function(a){this.Ln!==a&&(null!==a&&A(a,"function",sh,"finished"),this.Ln=a)}},easing:{configurable:!0,get:function(){return this.Nt},set:function(a){this.Nt=a}},isViewportUnconstrained:{configurable:!0,get:function(){return this.j},set:function(a){this.j=a}},isAnimating:{configurable:!0,get:function(){return this.qc}}});sh.prototype.getTemporaryState=sh.prototype.uA;sh.prototype.stop=sh.prototype.stop;sh.prototype.add=sh.prototype.add;
sh.prototype.addTemporaryPart=sh.prototype.uz;function Zh(a,b,c,d){a/=d/2;return 1>a?c/2*a*a+b:-c/2*(--a*(a-2)-1)+b}function ai(a,b,c,d){return a===d?b+c:c*(-Math.pow(2,-10*a/d)+1)+b}sh.className="Animation";sh.EaseLinear=function(a,b,c,d){return c*a/d+b};sh.EaseInOutQuad=Zh;sh.EaseInQuad=function(a,b,c,d){return c*(a/=d)*a+b};sh.EaseOutQuad=function(a,b,c,d){return-c*(a/=d)*(a-2)+b};sh.EaseInExpo=function(a,b,c,d){return 0===a?b:c*Math.pow(2,10*(a/d-1))+b};sh.EaseOutExpo=ai;
function gi(a,b,c){this.start=a;this.end=b;this.$u={};this.Qu=c;this.Mv=!1}gi.className="AnimationState";function hi(a,b,c){this.vd=null;this.tf=a;this.Ip=c||ii;this.Kk=null;void 0!==b&&(this.Kk=b,void 0===c&&(this.Ip=ji))}hi.prototype.copy=function(){var a=new hi(this.tf);a.Ip=this.Ip;var b=this.Kk;if(null!==b){var c={};void 0!==b.duration&&(c.duration=b.duration);void 0!==b.finished&&(c.finished=b.finished);void 0!==b.easing&&(c.easing=b.easing);a.Kk=c}return a};
function ki(a,b){a=a.Kk;null!==a&&(a.duration&&(b.duration=a.duration),a.finished&&(b.finished=a.finished),a.easing&&(b.easing=a.easing))}
na.Object.defineProperties(hi.prototype,{propertyName:{configurable:!0,get:function(){return this.tf},set:function(a){this.tf=a}},animationSettings:{configurable:!0,get:function(){return this.Kk},set:function(a){this.Kk=a}},startCondition:{configurable:!0,get:function(){return this.Ip},set:function(a){G&&db(a,hi,hi,"startCondition");this.Ip=a}}});var ii=new F(hi,"Default",1),ji=new F(hi,"Immediate",2),li=new F(hi,"Bundled",3);hi.className="AnimationTrigger";
hi.Default=ii;hi.Immediate=ji;hi.Bundled=li;function mi(a){ab(this);this.D=null;this.Ma=new H;this.ta="";this.rb=1;this.o=!1;this.j=this.Ai=this.Ic=this.Td=this.xc=this.Wb=this.Mb=this.Ra=this.Vb=this.Ha=this.te=this.Da=this.Ud=this.O=this.F=!0;this.Wo=[];a&&Object.assign(this,a)}t=mi.prototype;t.clear=function(){this.Ma.clear();this.Wo.length=0};t.$e=function(a){this.D=a};
t.toString=function(a){void 0===a&&(a=0);var b='Layer "'+this.name+'"';if(0>=a)return b;for(var c=0,d=0,e=0,f=0,g=0,h=this.Ma.iterator;h.next();){var k=h.value;k instanceof yf?e++:k instanceof V?d++:k instanceof R?f++:k instanceof Ke?g++:c++}h="";0<c&&(h+=c+" Parts ");0<d&&(h+=d+" Nodes ");0<e&&(h+=e+" Groups ");0<f&&(h+=f+" Links ");0<g&&(h+=g+" Adornments ");if(1<a)for(a=this.Ma.iterator;a.next();)c=a.value,h+="\n    "+c.toString(),d=c.data,null!==d&&lb(d)&&(h+=" #"+lb(d)),c instanceof V?h+=" "+
Ra(d):c instanceof R&&(h+=" "+Ra(c.fromNode)+" "+Ra(c.toNode));return b+" "+this.Ma.count+": "+h};
t.dc=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);if(!1===this.Ai)return null;G&&!a.s()&&v("findObjectAt: Point must have a real value, not: "+a.toString());var d=!1;null!==this.diagram&&this.diagram.viewportBounds.ca(a)&&(d=!0);for(var e=K.alloc(),f=this.Ma.m,g=f.length;g--;){var h=f[g];if((!0!==d||!1!==mg(h))&&h.isVisible()&&(e.assign(a),Kb(e,h.ne),h=h.dc(e,b,c),null!==h&&(null!==b&&(h=b(h)),null!==h&&(null===c||c(h)))))return K.free(e),h}K.free(e);return null};
t.Si=function(a,b,c,d){void 0===b&&(b=null);void 0===c&&(c=null);d instanceof H||d instanceof I||(d=new I);if(!1===this.Ai)return d;G&&!a.s()&&v("findObjectsAt: Point must have a real value, not: "+a.toString());var e=!1;null!==this.diagram&&this.diagram.viewportBounds.ca(a)&&(e=!0);for(var f=K.alloc(),g=this.Ma.m,h=g.length;h--;){var k=g[h];if((!0!==e||!1!==mg(k))&&k.isVisible()){f.assign(a);Kb(f,k.ne);var l=k;k.Si(f,b,c,d)&&(null!==b&&(l=b(l)),null===l||null!==c&&!c(l)||d.add(l))}}K.free(f);return d};
t.Lf=function(a,b,c,d,e){void 0===b&&(b=null);void 0===c&&(c=null);void 0===d&&(d=!1);e instanceof H||e instanceof I||(e=new I);if(!1===this.Ai)return e;G&&!a.s()&&v("findObjectsIn: Rect must have a real value, not: "+a.toString());var f=!1;null!==this.diagram&&this.diagram.viewportBounds.Te(a)&&(f=!0);for(var g=this.Ma.m,h=g.length;h--;){var k=g[h];if((!0!==f||!1!==mg(k))&&k.isVisible()){var l=k;k.Lf(a,b,c,d,e)&&(null!==b&&(l=b(l)),null===l||null!==c&&!c(l)||e.add(l))}}return e};
t.ev=function(a,b,c,d,e,f,g){if(!1===this.Ai)return e;for(var h=this.Ma.m,k=h.length;k--;){var l=h[k];if((!0!==g||!1!==mg(l))&&f(l)&&l.isVisible()){var m=l;l.Lf(a,b,c,d,e)&&(null!==b&&(m=b(m)),null===m||null!==c&&!c(m)||e.add(m))}}return e};
t.Bg=function(a,b,c,d,e,f){void 0===c&&(c=null);void 0===d&&(d=null);void 0===e&&(e=!0);if(!1!==e&&!0!==e){if(e instanceof H||e instanceof I)f=e;e=!0}f instanceof H||f instanceof I||(f=new I);if(!1===this.Ai)return f;G&&!a.s()&&v("findObjectsNear: Point must have a real value, not: "+a.toString());var g=!1;null!==this.diagram&&this.diagram.viewportBounds.ca(a)&&(g=!0);for(var h=K.alloc(),k=K.alloc(),l=this.Ma.m,m=l.length;m--;){var n=l[m];if((!0!==g||!1!==mg(n))&&n.isVisible()){h.assign(a);Kb(h,n.ne);
k.h(a.x+b,a.y);Kb(k,n.ne);var p=n;n.Bg(h,k,c,d,e,f)&&(null!==c&&(p=c(p)),null===p||null!==d&&!d(p)||f.add(p))}}K.free(h);K.free(k);return f};
t.Sd=function(a,b){if(this.visible){var c=this.Ma.m,d=c.length;if(0!==d){a=Na();for(var e=Na(),f=0;f<d;f++){var g=c[f];g.ix=f;if(g instanceof R){if(!1===g.Ad)continue}else if(g instanceof Ke&&null!==g.adornedPart)continue;var h=g.actualBounds;g.isVisible()&&hc(h,b)?(g.Sd(!0),a.push(g)):(g.Sd(!1),null!==g.adornments&&0<g.adornments.count&&e.push(g))}for(b=0;b<a.length;b++)for(c=a[b],ni(c),c=c.adornments;c.next();)d=c.value,d.measure(Infinity,Infinity),d.arrange(),d.Sd(!0);for(b=0;b<e.length;b++)ni(e[b]);
Pa(a);Pa(e)}}};function oi(a,b){var c=1;1!==a.rb&&(c=b.globalAlpha,b.globalAlpha=c*a.rb);return c}t.uc=function(a,b,c){if(this.visible&&0!==this.rb&&(void 0===c&&(c=!0),c||!this.isTemporary)){c=this.Ma.m;var d=c.length;if(0!==d){var e=oi(this,a),f=this.Wo;f.length=0;for(var g=b.scale,h=M.alloc(),k=0;k<d;k++)this.Oi(a,c[k],b,f,g,h,!0);M.free(h);a.globalAlpha=e}}};
t.Oi=function(a,b,c,d,e,f,g){if(!g||mg(b)){if(null!==d&&b instanceof R&&(b.isOrthogonal&&d.push(b),!1===b.Ad))return;g=!1;for(d=b.containingGroup;null!==d;)g?null!==d.hb&&f.sy(d.hb):null!==d.hb&&(g=!0,f.assign(d.hb)),d=d.containingGroup;var h=b.actualBounds;d=!1;if(g&&b.isVisible()){if(!f.Sc(h))return;d=!f.Te(h)}d&&(a.save(),a.beginPath(),a.rect(f.x,f.y,f.width,f.height),a.clip());h.width*e>c.Jr||h.height*e>c.Jr?b.uc(a,c):(e=b.actualBounds,f=b.naturalBounds,0===e.width||0===e.height||isNaN(e.x)||
isNaN(e.y)||!b.isVisible()||(c=b.transform,null!==b.areaBackground&&(pi(b,a,b.areaBackground,!0,!0,f,e),a.fillRect(e.x,e.y,e.width,e.height)),null===b.areaBackground&&null===b.background&&(pi(b,a,"rgba(0,0,0,0.3)",!0,!1,f,e),a.fillRect(e.x,e.y,e.width,e.height)),null!==b.background&&(a.transform(c.m11,c.m12,c.m21,c.m22,c.dx,c.dy),pi(b,a,b.background,!0,!1,f,e),a.fillRect(0,0,f.width/2,f.height/2),c.Ps()||(b=1/(c.m11*c.m22-c.m12*c.m21),a.transform(c.m22*b,-c.m12*b,-c.m21*b,c.m11*b,b*(c.m21*c.dy-c.m22*
c.dx),b*(c.m12*c.dx-c.m11*c.dy))))));d&&(a.restore(),a.Oc(!0))}};t.g=function(a,b,c,d,e){var f=this.diagram;null!==f&&f.bb(se,a,this,b,c,d,e)};t.Yi=function(a,b,c){var d=this.Ma;b.ri=this;if(a>=d.count)a=d.count;else if(d.M(a)===b)return-1;d.Bb(a,b);b.pq(c);d=this.diagram;null!==d&&(c?d.R():d.Yi(b));qi(this,a,b);return a};
t.kc=function(a,b,c){if(!c&&b.layer!==this&&null!==b.layer)return b.layer.kc(a,b,c);var d=this.Ma;if(0>a||a>=d.length){if(a=d.indexOf(b),0>a)return-1}else if(d.M(a)!==b&&(a=d.indexOf(b),0>a))return-1;b.qq(c);d.kb(a);d=this.diagram;null!==d&&(c?d.R():d.kc(b));b.ri=null;return a};
function qi(a,b,c){b=ri(a,b,c);if(c instanceof yf&&null!==c&&isNaN(c.zOrder)){if(0!==c.memberParts.count){for(var d=-1,e=a.Ma.m,f=e.length,g=0;g<f;g++){var h=e[g];if(h===c&&(b=g,0<=d))break;if(0>d&&h.containingGroup===c&&(d=g,0<=b))break}!(0>d)&&d<b&&(e=a.Ma,e.kb(b),e.Bb(d,c))}c=c.containingGroup;null!==c&&qi(a,-1,c)}}
function ri(a,b,c){var d=c.zOrder;if(isNaN(d))return b;a=a.Ma;var e=a.count;if(1>=e)return b;0>b&&(b=a.indexOf(c));if(0>b)return-1;for(var f=b-1,g=NaN;0<=f;){g=a.M(f).zOrder;if(!isNaN(g))break;f--}for(var h=b+1,k=NaN;h<e;){k=a.M(h).zOrder;if(!isNaN(k))break;h++}if(!isNaN(g)&&g>d)for(;;){if(-1===f||g<=d){f++;if(f===b)break;a.kb(b);a.Bb(f,c);return f}for(g=NaN;0<=--f&&(g=a.M(f).zOrder,isNaN(g)););}else if(!isNaN(k)&&k<d)for(;;){if(h===e||k>=d){h--;if(h===b)break;a.kb(b);a.Bb(h,c);return h}for(k=NaN;++h<
e&&(k=a.M(h).zOrder,isNaN(k)););}return b}
na.Object.defineProperties(mi.prototype,{parts:{configurable:!0,get:function(){return this.Ma.iterator}},partsBackwards:{configurable:!0,get:function(){return this.Ma.iteratorBackwards}},diagram:{configurable:!0,get:function(){return this.D}},name:{configurable:!0,get:function(){return this.ta},set:function(a){A(a,"string",mi,"name");var b=this.ta;if(b!==a){var c=this.diagram;if(null!==c)for(""===b&&v("Cannot rename default Layer to: "+a),c=
c.layers;c.next();)c.value.name===a&&v("Layer.name is already present in this diagram: "+a);this.ta=a;this.g("name",b,a);for(a=this.Ma.iterator;a.next();)a.value.layerName=this.ta}}},opacity:{configurable:!0,get:function(){return this.rb},set:function(a){var b=this.rb;b!==a&&(A(a,"number",mi,"opacity"),(0>a||1<a)&&Ba(a,"0 <= value <= 1",mi,"opacity"),this.rb=a,this.g("opacity",b,a),a=this.diagram,null!==a&&a.R())}},isTemporary:{configurable:!0,get:function(){return this.o},
set:function(a){var b=this.o;if(b!==a){A(a,"boolean",mi,"isTemporary");if(this.o=a)this.isInDocumentBounds=!1;this.g("isTemporary",b,a)}}},visible:{configurable:!0,get:function(){return this.Ic},set:function(a){var b=this.Ic;if(b!==a){A(a,"boolean",mi,"visible");this.Ic=a;this.g("visible",b,a);for(b=this.Ma.iterator;b.next();)b.value.Tb(a);a=this.diagram;null!==a&&a.R()}}},pickable:{configurable:!0,get:function(){return this.Ai},set:function(a){var b=this.Ai;b!==a&&(A(a,
"boolean",mi,"pickable"),this.Ai=a,this.g("pickable",b,a))}},isInDocumentBounds:{configurable:!0,get:function(){return this.j},set:function(a){this.j!==a&&(this.j=a,null!==this.diagram&&this.diagram.Wa())}},allowCopy:{configurable:!0,get:function(){return this.F},set:function(a){var b=this.F;b!==a&&(A(a,"boolean",mi,"allowCopy"),this.F=a,this.g("allowCopy",b,a))}},allowDelete:{configurable:!0,get:function(){return this.O},set:function(a){var b=this.O;b!==
a&&(A(a,"boolean",mi,"allowDelete"),this.O=a,this.g("allowDelete",b,a))}},allowTextEdit:{configurable:!0,get:function(){return this.Ud},set:function(a){var b=this.Ud;b!==a&&(A(a,"boolean",mi,"allowTextEdit"),this.Ud=a,this.g("allowTextEdit",b,a))}},allowGroup:{configurable:!0,get:function(){return this.Da},set:function(a){var b=this.Da;b!==a&&(A(a,"boolean",mi,"allowGroup"),this.Da=a,this.g("allowGroup",b,a))}},allowUngroup:{configurable:!0,get:function(){return this.te},
set:function(a){var b=this.te;b!==a&&(A(a,"boolean",mi,"allowUngroup"),this.te=a,this.g("allowUngroup",b,a))}},allowLink:{configurable:!0,get:function(){return this.Ha},set:function(a){var b=this.Ha;b!==a&&(A(a,"boolean",mi,"allowLink"),this.Ha=a,this.g("allowLink",b,a))}},allowRelink:{configurable:!0,get:function(){return this.Vb},set:function(a){var b=this.Vb;b!==a&&(A(a,"boolean",mi,"allowRelink"),this.Vb=a,this.g("allowRelink",b,a))}},allowMove:{configurable:!0,
get:function(){return this.Ra},set:function(a){var b=this.Ra;b!==a&&(A(a,"boolean",mi,"allowMove"),this.Ra=a,this.g("allowMove",b,a))}},allowReshape:{configurable:!0,get:function(){return this.Mb},set:function(a){var b=this.Mb;b!==a&&(A(a,"boolean",mi,"allowReshape"),this.Mb=a,this.g("allowReshape",b,a))}},allowResize:{configurable:!0,get:function(){return this.Wb},set:function(a){var b=this.Wb;b!==a&&(A(a,"boolean",mi,"allowResize"),this.Wb=a,this.g("allowResize",b,a))}},
allowRotate:{configurable:!0,get:function(){return this.xc},set:function(a){var b=this.xc;b!==a&&(A(a,"boolean",mi,"allowRotate"),this.xc=a,this.g("allowRotate",b,a))}},allowSelect:{configurable:!0,get:function(){return this.Td},set:function(a){var b=this.Td;b!==a&&(A(a,"boolean",mi,"allowSelect"),this.Td=a,this.g("allowSelect",b,a))}}});mi.prototype.findObjectsNear=mi.prototype.Bg;mi.prototype.findObjectsIn=mi.prototype.Lf;mi.prototype.findObjectsAt=mi.prototype.Si;
mi.prototype.findObjectAt=mi.prototype.dc;mi.className="Layer";
function Q(a,b){si||(ti(),si=!0);ab(this);Ge=this;this.vb=!0;this.La=null;this.Aa=this.Ba=0;this.Ia=null;if(Wg){var c=this,d=function(){c.removeEventListener(sa.document,"DOMContentLoaded",d,!1);c.setRTL()};null!==sa.document.body?this.setRTL():c.addEventListener(sa.document,"DOMContentLoaded",d,!1)}this.Kl=null;ui.add("Model",vi);var e=this;this.Aw=function(a){var b=e.partManager;if(a.model===b.diagram.model&&b.diagram.ba){b.diagram.ba=!1;try{var c=a.change;""===a.modelChange&&c===se&&b.updateDataBindings(a.object,
a.propertyName)}finally{b.diagram.ba=!0}}};this.Bw=function(a){e.partManager.doModelChanged(a)};this.qu=this.su=null;wi(this);this.model=xi();this.vh=!0;yi(this);this.layout=new zi;this.vh=!1;this.xk=this.yk=this.wk=this.vk=this.QA=this.sk=this.mw=null;this.Bq=function(){};this.preventDefault=null;this.ho=!1;this.ji=new Ai;void 0!==a&&("string"===typeof a||sa.Element&&a instanceof Element?Bi(this,a):b=a);this.vb=!1;b&&this.Lm(b);return this}var Ci,Ge;
function wi(a){a.Vd=new oh;a.Vd.$e(a);a.zb=17;a.tx=!1;a.jo=!1;a.lu="default";a.Ua=new H;a.fz=new yb;a.Iy();a.Hy();a.rb=1;a.pa=(new K(NaN,NaN)).freeze();a.nu=new K(NaN,NaN);a.ya=1;a.er=1;a.nv=(new K(NaN,NaN)).freeze();a.tv=NaN;a.Gv=1E-4;a.Cv=100;a.Ab=new Jb;a.rt=(new K(NaN,NaN)).freeze();a.Su=(new M(NaN,NaN,NaN,NaN)).freeze();a.Rj=(new fc(0,0,0,0)).freeze();a.Sj=$h;a.nt=!1;a.qw=null;a.rw=null;a.$h=zh;a.Sk=dd;a.bh=zh;a.vr=dd;a.lv=Cc;a.uv=Cc;a.bd=!0;a.co=!1;a.De=new I;a.hi=new yb;a.Dn=!0;a.Pq=250;a.Lk=
-1;a.Rq=(new fc(16,16,16,16)).freeze();a.vg=!1;a.bl=!1;a.Mn=!0;a.pr=new oe;a.pr.diagram=a;a.rh=new oe;a.rh.diagram=a;a.Dj=new oe;a.Dj.diagram=a;a.Lg=null;a.rf=null;a.wu=!1;Di(a);a.Hi=new I;a.vv=!0;a.ot=Ei;a.xw=!1;a.qt=Mf;a.kt="auto";a.kj="auto";a.Mg=null;a.Ug=null;a.Og=null;a.nh=null;a.lh=null;a.kh=null;a.Jv=null;a.ih=null;a.gv=!1;a.jh=null;a.mh=null;a.Fh=null;a.Pg=null;a.eu=!1;a.iu={};a.Hl=[null,null];a.vh=!1;a.Dw=!1;a.uu=!1;a.Kt=!1;a.zw=!0;a.cd=!1;a.zj=!1;a.Fx=!0;a.Ce=-2;a.ph=new yb;a.ap=new H;
a.dh=!1;a.Cd=!0;a.Dk=!0;a.F=!0;a.O=!0;a.Ek=!1;a.Vm=!0;a.Ud=!0;a.Da=!0;a.te=!0;a.wt=!0;a.Ha=!0;a.Vb=!0;a.Ra=!0;a.Mb=!0;a.Wb=!0;a.xc=!0;a.Td=!0;a.xt=!0;a.At=!0;a.yw=!1;a.pl=!1;a.Zn=!0;a.$n=!0;a.vt=!0;a.zt=!0;a.lt=16;a.mt=16;a.$r=!1;a.pu=!1;a.tu=0;a.ru=0;a.sb=(new fc(5)).freeze();a.ux=(new I).freeze();a.Fv=999999999;a.ax=(new I).freeze();a.vj=!0;a.wj=!0;a.xj=!0;a.kf=!1;a.dg=!1;a.Zh=!0;a.fg=!1;a.Wy=new I;a.bx=new I;a.fd=null;a.nx=1;a.vx=0;a.ld={scale:1,position:new K,bounds:new M,Ox:new Hb,Ay:new Hb,
vy:!1};a.Ex=(new M(NaN,NaN,NaN,NaN)).freeze();a.Sp=(new Hb(NaN,NaN)).freeze();a.gr=(new M(NaN,NaN,NaN,NaN)).freeze();a.wv=!1;a.j=new yb;var b=new V,c=new Yg;c.bind(new Fi("text","",Ra));b.add(c);a.bz=b;a.j.add("",b);b=new V;c=new Yg;c.stroke="brown";c.bind(new Fi("text","",Ra));b.add(c);a.j.add("Comment",b);b=new V;b.selectable=!1;b.avoidable=!1;c=new Kf;c.figure="Ellipse";c.fill="black";c.stroke=null;c.desiredSize=(new Hb(3,3)).ia();b.add(c);a.j.add("LinkLabel",b);a.Ic=new yb;b=new yf;b.selectionObjectName=
"GROUPPANEL";b.type=X.Vertical;c=new Yg;c.font="bold 12pt sans-serif";c.bind(new Fi("text","",Ra));b.add(c);c=new X(X.Auto);c.name="GROUPPANEL";var d=new Kf;d.figure="Rectangle";d.fill="rgba(128,128,128,0.2)";d.stroke="black";c.add(d);d=new ng;d.padding=(new fc(5,5,5,5)).ia();c.add(d);b.add(c);a.$y=b;a.Ic.add("",b);a.o=new yb;b=new R;c=new Kf;c.isPanelMain=!0;b.add(c);c=new Kf;c.toArrow="Standard";c.fill="black";c.stroke=null;c.strokeWidth=0;b.add(c);a.az=b;a.o.add("",b);b=new R;c=new Kf;c.isPanelMain=
!0;c.stroke="brown";b.add(c);a.o.add("Comment",b);b=new Ke;b.type=X.Auto;c=new Kf;c.fill=null;c.stroke="dodgerblue";c.strokeWidth=3;b.add(c);c=new ng;c.margin=(new fc(1.5,1.5,1.5,1.5)).ia();b.add(c);a.Rv=b;a.Zu=b;b=new Ke;b.type=X.Link;c=new Kf;c.isPanelMain=!0;c.fill=null;c.stroke="dodgerblue";c.strokeWidth=3;b.add(c);a.Av=b;a.de=null;a.tr=!1;a.Vk=null;a.partManager=new vi;a.toolManager=new Va;a.toolManager.initializeStandardTools();a.defaultTool=a.toolManager;a.currentTool=a.defaultTool;a.Eu=null;
a.Bn=new Se;a.fw=null;a.lw=null;a.ms=!1;a.commandHandler=Gi();a.ns=!1;a.rr=null;a.sr=Db;a.Bx=!1;a.jc=1;a.Di=null;a.Jr=1;a.Mr=0;a.lx=[0,0,0,0,0];a.Nr=0;a.Er=1;a.gx=0;a.hx=new K;a.mz=500;a.Qq=new K;a.Zt=!1}Q.prototype.clear=function(){this.animationManager.wc();this.model.clear();Hi=null;Ii="";Ji(this,!1);this.ap.clear();Ki();this.ph.clear();this.Wa();this.Ya();this.R()};
function Ji(a,b){a.animationManager.wc(!0);a.ux=(new I).freeze();a.ax=(new I).freeze();var c=a.skipsUndoManager,d=null!==a.ac&&void 0!==a.ac;d&&(a.skipsUndoManager=!0);var e=null;null!==a.de&&(e=a.de.part,null!==e&&a.remove(e));var f=[],g=a.Ua.length;if(b){for(b=0;b<g;b++)for(var h=a.Ua.m[b].parts;h.next();){var k=h.value;k!==e&&null===k.data&&f.push(k)}for(b=0;b<f.length;b++)a.remove(f[b])}for(b=0;b<g;b++)a.Ua.m[b].clear();a.partManager.clear();a.De.clear();a.hi.clear();a.Hi.clear();a.Vk=null;a.ap.clear();
Ki();a.ph.clear();Oa=[];null!==e&&(a.add(e),a.partManager.parts.remove(e));d&&(a.skipsUndoManager=c);return f}function Gi(){return null}Q.prototype.reset=function(){this.clear();this.vb=!0;wi(this);Li(this);this.vh=!0;yi(this);this.layout=new zi;this.vh=!1;this.model=xi();this.model.undoManager=new xe;this.vb=this.ho=!1;this.R()};
Q.prototype.setRTL=function(a){a=void 0===a?this.div:a;null===a&&(a=sa.document.body);var b=wa("div");b.dir="rtl";b.style.cssText="font-size: 14px; width: 1px; height: 1px; position: absolute; top: -1000px; overflow: scroll;";b.textContent="A";a.appendChild(b);var c="reverse";0<b.scrollLeft?c="default":(b.scrollLeft=1,0===b.scrollLeft&&(c="negative"));a.removeChild(b);this.lu=c};
Q.prototype.setScrollWidth=function(a){a=void 0===a?this.div:a;null===a&&(a=sa.document.body);var b=0;if(Wg){var c=Mi;b=Ci;null===c&&(c=Mi=wa("p"),c.style.width="100%",c.style.height="200px",c.style.boxSizing="content-box",b=Ci=wa("div"),b.style.position="absolute",b.style.visibility="hidden",b.style.width="200px",b.style.height="150px",b.style.boxSizing="content-box",b.appendChild(c));b.style.overflow="hidden";a.appendChild(b);var d=c.offsetWidth;b.style.overflow="scroll";c=c.offsetWidth;d===c&&
(c=b.clientWidth);a.removeChild(b);b=d-c;0!==b||$a||(b=11)}this.zb=b;this.tx=!0};Q.prototype.mb=function(a){a.classType===Q?this.autoScale=a:Ea(this,a)};Q.prototype.toString=function(a){void 0===a&&(a=0);var b="";this.div&&this.div.id&&(b=this.div.id);b='Diagram "'+b+'"';if(0>=a)return b;for(var c=this.Ua.iterator;c.next();)b+="\n  "+c.value.toString(a-1);return b};Q.prototype.addEventListener=function(a,b,c,d){a.addEventListener(b,c,{capture:d,passive:!1})};
Q.prototype.removeEventListener=function(a,b,c,d){a.removeEventListener(b,c,{capture:d})};
function Ni(a){var b=a.Ia.Qa;b instanceof HTMLCanvasElement&&(a.addEventListener(b,"pointerdown",a.vk,!1),a.addEventListener(b,"pointermove",a.wk,!1),a.addEventListener(b,"pointerup",a.yk,!1),a.addEventListener(b,"pointerout",a.xk,!1),a.addEventListener(b,"pointerenter",a.Qz,!1),a.addEventListener(b,"pointerleave",a.Rz,!1),a.addEventListener(b,"wheel",a.sk,!1),a.addEventListener(b,"keydown",a.GA,!1),a.addEventListener(b,"keyup",a.HA,!1),a.addEventListener(b,"blur",a.Cz,!1),a.addEventListener(b,"focus",
a.Dz,!1),a.addEventListener(b,"selectstart",function(a){a.preventDefault();return!1},!1),a.addEventListener(b,"contextmenu",function(a){a.preventDefault();return!1},!1),a.addEventListener(sa,"resize",a.mw,!1),$a&&a.addEventListener(b,"touchstart",function(a){a.preventDefault()},!1))}function $e(a){30<a.Mr&&(a.Di=1)}function kf(a,b){null!==a.Di&&(a.Di=null,b&&a.Bq(),G&&G.Yx||(a.Mr=0,a.lx=[0,0,0,0,0],a.Nr=0))}
Q.prototype.computePixelRatio=function(){return null!==this.Di?this.Di:sa.devicePixelRatio||1};Q.prototype.doMouseMove=function(){this.currentTool.doMouseMove()};Q.prototype.doMouseDown=function(){this.currentTool.doMouseDown()};Q.prototype.doMouseUp=function(){this.currentTool.doMouseUp()};Q.prototype.doMouseWheel=function(){this.currentTool.doMouseWheel()};Q.prototype.doKeyDown=function(){this.currentTool.doKeyDown()};Q.prototype.doKeyUp=function(){this.currentTool.doKeyUp()};
Q.prototype.doFocus=function(){this.focus()};Q.prototype.focus=function(){if(this.Ia)if(this.scrollsPageOnFocus)this.Ia.focus();else{var a=sa.scrollX||sa.pageXOffset,b=sa.scrollY||sa.pageYOffset;this.Ia.focus();sa.scrollTo(a,b)}};Q.prototype.Dz=function(){this.D.V("GainedFocus")};Q.prototype.Cz=function(){this.D.V("LostFocus")};
function Ah(a){if(null!==a.Ia){var b=a.La;if(null!==b&&0!==b.clientWidth&&0!==b.clientHeight){a.tx||a.setScrollWidth();var c=a.dg?a.zb:0,d=a.kf?a.zb:0,e=a.jc;a.jc=a.computePixelRatio();a.jc!==e&&(a.co=!0,a.Lb());if(b.clientWidth!==a.Ba+c||b.clientHeight!==a.Aa+d)a.wj=!0,a.bd=!0,b=a.layout,null!==b&&b.isViewportSized&&a.autoScale===zh&&(a.bl=!0,b.C()),a.cd||a.Lb()}}}
function yi(a){var b=new mi;b.name="Background";a.em(b);b=new mi;b.name="";a.em(b);b=new mi;b.name="Foreground";a.em(b);b=new mi;b.name="Adornment";b.isTemporary=!0;b.isInDocumentBounds=!1;a.em(b);b=new mi;b.name="Tool";b.isTemporary=!0;b.isInDocumentBounds=!0;a.em(b);b=new mi;b.name="Grid";b.allowSelect=!1;b.pickable=!1;b.isTemporary=!0;b.isInDocumentBounds=!1;a.Ix(b,a.ik("Background"))}
function Vi(a){var b=new X(X.Grid);b.name="GRID";var c=new Kf;c.figure="LineH";c.stroke="lightgray";c.strokeWidth=.5;c.interval=1;b.add(c);c=new Kf;c.figure="LineH";c.stroke="gray";c.strokeWidth=.5;c.interval=5;b.add(c);c=new Kf;c.figure="LineH";c.stroke="gray";c.strokeWidth=1;c.interval=10;b.add(c);c=new Kf;c.figure="LineV";c.stroke="lightgray";c.strokeWidth=.5;c.interval=1;b.add(c);c=new Kf;c.figure="LineV";c.stroke="gray";c.strokeWidth=.5;c.interval=5;b.add(c);c=new Kf;c.figure="LineV";c.stroke=
"gray";c.strokeWidth=1;c.interval=10;b.add(c);c=new U;c.add(b);c.layerName="Grid";c.zOrder=0;c.isInDocumentBounds=!1;c.isAnimated=!1;c.pickable=!1;c.locationObjectName="GRID";a.add(c);a.partManager.parts.remove(c);b.visible=!1;return b}function Wi(){this.D.pu?this.D.pu=!1:this.D.isEnabled?this.D.Ux(this):Xi(this.D)}function Yi(a){this.D.isEnabled?(this.D.tu=a.target.scrollTop,this.D.ru=a.target.scrollLeft):Xi(this.D)}
Q.prototype.Ux=function(a){if(null!==this.Ia){var b=this.su,c=this.qu;this.$r=!0;var d=this.documentBounds,e=this.viewportBounds,f=this.Rj,g=d.x-f.left,h=d.y-f.top,k=d.width+f.left+f.right,l=d.height+f.top+f.bottom,m=d.right+f.right;f=d.bottom+f.bottom;var n=e.x;d=e.y;var p=e.width,r=e.height,q=e.right,u=e.bottom;e=this.scale;var x=a.scrollLeft;if(this.jo)switch(this.lu){case "negative":x=x+a.scrollWidth-a.clientWidth;break;case "reverse":x=a.scrollWidth-x-a.clientWidth}var y=x;p<k||r<l?(x=K.allocAt(this.position.x,
this.position.y),this.allowHorizontalScroll&&this.ru!==y&&(x.x=y/e+g,this.ru=y),this.allowVerticalScroll&&this.tu!==a.scrollTop&&(x.y=a.scrollTop/e+h,this.tu=a.scrollTop),this.position=x,K.free(x),this.wj=this.$r=!1):(x=K.alloc(),a.hz&&this.allowHorizontalScroll&&(g<n&&(this.position=x.h(y+g,this.position.y)),m>q&&(this.position=x.h(-(b.scrollWidth-this.Ba)+y-this.Ba/e+m,this.position.y))),a.iz&&this.allowVerticalScroll&&(h<d&&(this.position=x.h(this.position.x,a.scrollTop+h)),f>u&&(this.position=
x.h(this.position.x,-(b.scrollHeight-this.Aa)+a.scrollTop-this.Aa/e+f))),K.free(x),Zi(this),this.wj=this.$r=!1,d=this.documentBounds,e=this.viewportBounds,m=d.right,q=e.right,f=d.bottom,u=e.bottom,g=d.x,n=e.x,h=d.y,d=e.y,p>=k&&g>=n&&m<=q&&(c.style.width="1px"),r>=l&&h>=d&&f<=u&&(c.style.height="1px"))}};Q.prototype.computeBounds=function(a){void 0===a&&(a=new M);uh(this);return $i(this,a)};
function $i(a,b){if(a.fixedBounds.s())return b.assign(a.fixedBounds),b.Yp(a.sb),b;for(var c=!0,d=a.Ua.m,e=d.length,f=0;f<e;f++){var g=d[f];if(g.visible&&g.isInDocumentBounds){g=g.Ma.m;for(var h=g.length,k=0;k<h;k++){var l=g[k];l.isInDocumentBounds&&l.isVisible()&&(l=l.actualBounds,l.s()&&(c?(c=!1,b.assign(l)):b.Xc(l)))}}}c&&b.h(0,0,0,0);b.Yp(a.sb);return b}
Q.prototype.computePartsBounds=function(a,b){void 0===b&&(b=!1);var c=null;if(Ha(a))for(var d=0;d<a.length;d++){var e=a[d];!b&&e instanceof R||(e.Ya(),null===c?c=e.actualBounds.copy():c.Xc(e.actualBounds))}else for(a=a.iterator;a.next();)d=a.value,!b&&d instanceof R||(d.Ya(),null===c?c=d.actualBounds.copy():c.Xc(d.actualBounds));return null===c?new M(NaN,NaN,0,0):c};
function aj(a,b){if((b||a.fg)&&!a.vb&&null!==a.Ia&&a.documentBounds.s()){if(b){var c=a.initialPosition;if(c.s()){a.position=c;return}c=K.alloc();c.ej(a.documentBounds,a.initialDocumentSpot);var d=a.viewportBounds;d=M.allocAt(0,0,d.width,d.height);var e=K.alloc();e.ej(d,a.initialViewportSpot);e.h(c.x-e.x,c.y-e.y);a.position=e;M.free(d);K.free(e);K.free(c)}a.vb=!0;c=a.$h;b&&a.bh!==zh&&(c=a.bh);var f=c!==zh?bj(a,c):a.scale;c=a.pa.x;d=a.pa.y;e=a.Ba/f;var g=a.Aa/f,h=a.Sk,k=a.vr;b&&!h.fb()&&(k.fb()||k.Kb())&&
(h=k.Kb()?Ic:k);cj(a,a.documentBounds,e,g,h,b);b=a.scale;a.scale=f;a.vb=!1;dj(a);ej(a,!0,!1);f=a.viewportBounds;if(!(L.A(f.I,c)&&L.A(f.J,d)&&L.A(f.fa,e)&&L.A(f.ea,g)))a.onViewportBoundsChanged(new M(c,d,e,g),f,b,!1)}}
function bj(a,b){var c=a.er;if(null===a.Ia)return c;a.Ya();var d=a.documentBounds;if(!d.s())return c;var e=d.width;d=d.height;var f=a.Ba+(a.dg?a.zb:0),g=a.Aa+(a.kf?a.zb:0),h=f/e,k=g/d;return b===fj?(b=Math.min(k,h),b>c&&(b=c),b<a.minScale&&(b=a.minScale),b>a.maxScale&&(b=a.maxScale),b):b===gj?(b=k>h?(g-a.zb)/d:(f-a.zb)/e,b>c&&(b=c),b<a.minScale&&(b=a.minScale),b>a.maxScale&&(b=a.maxScale),b):a.scale}
Q.prototype.zoomToFit=function(){var a=this.Sj;this.Sj=$h;this.scale=bj(this,fj);a!==$h&&(aj(this,!1),cj(this,this.documentBounds,this.Ba/this.ya,this.Aa/this.ya,this.Sk,!1));this.Sj=a};t=Q.prototype;
t.sB=function(a,b){void 0===b&&(b=fj);var c=a.width,d=a.height;if(!(0===c||0===d||isNaN(c)&&isNaN(d))){var e=1;if(b===fj||b===gj)if(isNaN(c))e=this.viewportBounds.height*this.scale/d;else if(isNaN(d))e=this.viewportBounds.width*this.scale/c;else{e=this.Ba;var f=this.Aa;e=b===gj?f/d>e/c?(f-(this.kf?this.zb:0))/d:(e-(this.dg?this.zb:0))/c:Math.min(f/d,e/c)}this.scale=e;this.position=new K(a.x,a.y)}};
t.vz=function(a,b){this.Ya();var c=this.documentBounds,d=this.viewportBounds;this.position=new K(c.x+(a.x*c.width+a.offsetX)-(b.x*d.width-b.offsetX),c.y+(a.y*c.height+a.offsetY)-(b.y*d.height-b.offsetY))};t.pA=function(a){if(a instanceof O){this.rr=a;var b=K.alloc();this.sr=this.Jq(a.ja(Cc,b));K.free(b)}else this.rr=null,this.sr=Db};
function cj(a,b,c,d,e,f){var g=K.allocAt(a.pa.x,a.pa.y),h=g.x,k=g.y;if(null!==a.rr){var l=K.alloc();l=a.rr.ja(Cc,l);h=l.x-a.sr.x/a.scale;k=l.y-a.sr.y/a.scale;e=Bc;K.free(l)}if(f||a.scrollMode===$h)e.fb()&&(c>b.width&&(h=b.x+(e.x*b.width+e.offsetX)-(e.x*c-e.offsetX)),d>b.height&&(k=b.y+(e.y*b.height+e.offsetY)-(e.y*d-e.offsetY))),e=a.Rj,f=c-b.width,c<b.width+e.left+e.right?(h=Math.min(h+c/2,b.right+Math.max(f,e.right)-c/2),h=Math.max(h,b.left-Math.max(f,e.left)+c/2),h-=c/2):h>b.left?h=b.left:h<b.right-
c&&(h=b.right-c),c=d-b.height,d<b.height+e.top+e.bottom?(k=Math.min(k+d/2,b.bottom+Math.max(c,e.bottom)-d/2),k=Math.max(k,b.top-Math.max(c,e.top)+d/2),k-=d/2):k>b.top?k=b.top:k<b.bottom-d&&(k=b.bottom-d);g.x=isFinite(h)?h:-a.sb.left;g.y=isFinite(k)?k:-a.sb.top;null!==a.positionComputation&&(b=a.positionComputation(a,g),g.x=b.x,g.y=b.y);Wh(a.Vd,a.pa,g);a.pa.h(g.x,g.y);Li(a);K.free(g)}
t.mm=function(a,b){void 0===b&&(b=!0);if(b){if(a=zf(this,a,function(a){return a.part},function(a){return a.canSelect()}),a instanceof U)return a}else if(a=zf(this,a,function(a){return a.part}),a instanceof U)return a;return null};t.dc=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);uh(this);for(var d=this.Ua.iteratorBackwards;d.next();){var e=d.value;if(e.visible&&(e=e.dc(a,b,c),null!==e))return e}return null};
function zf(a,b,c,d){void 0===c&&(c=null);void 0===d&&(d=null);uh(a);for(a=a.Ua.iteratorBackwards;a.next();){var e=a.value;if(e.visible&&!e.isTemporary&&(e=e.dc(b,c,d),null!==e))return e}return null}t.cA=function(a,b,c){void 0===b&&(b=!0);return hj(this,a,function(a){return a.part},b?function(a){return a instanceof U&&a.canSelect()}:null,c)};
function hj(a,b,c,d,e){void 0===c&&(c=null);void 0===d&&(d=null);e instanceof H||e instanceof I||(e=new I);uh(a);for(a=a.Ua.iteratorBackwards;a.next();){var f=a.value;f.visible&&!f.isTemporary&&f.Si(b,c,d,e)}return e}t.Si=function(a,b,c,d){void 0===b&&(b=null);void 0===c&&(c=null);d instanceof H||d instanceof I||(d=new I);uh(this);for(var e=this.Ua.iteratorBackwards;e.next();){var f=e.value;f.visible&&f.Si(a,b,c,d)}return d};
t.gy=function(a,b,c,d){void 0===b&&(b=!1);void 0===c&&(c=!0);return ij(this,a,function(a){return a instanceof U&&(!c||a.canSelect())},b,d)};t.Lf=function(a,b,c,d,e){void 0===b&&(b=null);void 0===c&&(c=null);void 0===d&&(d=!1);e instanceof H||e instanceof I||(e=new I);uh(this);for(var f=this.Ua.iteratorBackwards;f.next();){var g=f.value;g.visible&&g.Lf(a,b,c,d,e)}return e};
t.ev=function(a,b,c,d,e,f){var g=new I;uh(this);for(var h=this.Ua.iteratorBackwards;h.next();){var k=h.value;k.visible&&k.ev(a,b,c,d,g,e,f)}return g};function ij(a,b,c,d,e){var f=null;void 0===f&&(f=null);void 0===c&&(c=null);void 0===d&&(d=!1);e instanceof H||e instanceof I||(e=new I);uh(a);for(a=a.Ua.iteratorBackwards;a.next();){var g=a.value;g.visible&&!g.isTemporary&&g.Lf(b,f,c,d,e)}return e}
t.dA=function(a,b,c,d,e){void 0===c&&(c=!0);void 0===d&&(d=!0);return jj(this,a,b,function(a){return a instanceof U&&(!d||a.canSelect())},c,e)};t.Bg=function(a,b,c,d,e,f){void 0===c&&(c=null);void 0===d&&(d=null);void 0===e&&(e=!0);if(!1!==e&&!0!==e){if(e instanceof H||e instanceof I)f=e;e=!0}f instanceof H||f instanceof I||(f=new I);uh(this);for(var g=this.Ua.iteratorBackwards;g.next();){var h=g.value;h.visible&&h.Bg(a,b,c,d,e,f)}return f};
function jj(a,b,c,d,e,f){var g=null;void 0===g&&(g=null);void 0===d&&(d=null);void 0===e&&(e=!0);if(!1!==e&&!0!==e){if(e instanceof H||e instanceof I)f=e;e=!0}f instanceof H||f instanceof I||(f=new I);uh(a);for(a=a.Ua.iteratorBackwards;a.next();){var h=a.value;h.visible&&!h.isTemporary&&h.Bg(b,c,g,d,e,f)}return f}Q.prototype.acceptEvent=function(a){return kj(this,a,a instanceof MouseEvent)};
function kj(a,b,c){var d=a.rh;a.rh=a.Dj;a.Dj=d;d.diagram=a;d.event=b;c?lj(a,b,d):(d.viewPoint=a.rh.viewPoint,d.documentPoint=a.rh.documentPoint);a=0;b.ctrlKey&&(a+=1);b.altKey&&(a+=2);b.shiftKey&&(a+=4);b.metaKey&&(a+=8);d.modifiers=a;d.button=b.button;void 0!==b.buttons&&(d.buttons=b.buttons);$a&&0===b.button&&b.ctrlKey&&(d.button=2);d.down=!1;d.up=!1;d.clickCount=1;d.delta=0;d.handled=!1;d.bubbles=!1;d.timestamp=b.timeStamp;d.isMultiTouch=!1;d.targetDiagram=mj(b,b.target);d.targetObject=null;return d}
function mj(a,b){if(null===b)return null;if(b=b.D)return b;(b=a.path)||"function"!==typeof a.composedPath||(b=a.composedPath());return b&&b[0]&&b[0].D?b[0].D:null}
function nj(a,b,c,d,e,f){var g=a.rh;a.rh=a.Dj;a.Dj=g;g.diagram=a;g.clickCount=1;a=g.delta=0;b.ctrlKey&&(a+=1);b.altKey&&(a+=2);b.shiftKey&&(a+=4);b.metaKey&&(a+=8);g.modifiers=a;g.event=b;g.timestamp=b.timeStamp;g.button=b.button;g.buttons=b.buttons;$a&&0===b.button&&b.ctrlKey&&(g.button=2);g.down=c;g.up=d;g.handled=!1;g.bubbles=e;g.isMultiTouch=f;return g}
function oj(a,b,c){if(b.bubbles)return G&&G.qy&&Fa("NOT handled "+c.type+" "+b.toString()),!0;G&&G.qy&&Fa("handled "+c.type+" "+a.currentTool.name+" "+b.toString());void 0!==c.stopPropagation&&c.stopPropagation();!1!==c.cancelable&&c.preventDefault();c.cancelBubble=!0;return!1}
Q.prototype.GA=function(a){var b=this.D;if(!this.D.isEnabled)return!1;var c=kj(b,a,!1);c.key=String.fromCharCode(a.which);c.down=!0;switch(a.which){case 8:c.key="Backspace";break;case 33:c.key="PageUp";break;case 34:c.key="PageDown";break;case 35:c.key="End";break;case 36:c.key="Home";break;case 37:c.key="Left";break;case 38:c.key="Up";break;case 39:c.key="Right";break;case 40:c.key="Down";break;case 45:c.key="Insert";break;case 46:c.key="Del";break;case 48:c.key="0";break;case 187:case 61:case 107:c.key=
"Add";break;case 189:case 173:case 109:c.key="Subtract";break;case 27:c.key="Esc"}b.doKeyDown();return oj(b,c,a)};
Q.prototype.HA=function(a){var b=this.D;if(!b.isEnabled)return!1;var c=kj(b,a,!1);c.key=String.fromCharCode(a.which);c.up=!0;switch(a.which){case 8:c.key="Backspace";break;case 33:c.key="PageUp";break;case 34:c.key="PageDown";break;case 35:c.key="End";break;case 36:c.key="Home";break;case 37:c.key="Left";break;case 38:c.key="Up";break;case 39:c.key="Right";break;case 40:c.key="Down";break;case 45:c.key="Insert";break;case 46:c.key="Del"}b.doKeyUp();return oj(b,c,a)};
Q.prototype.Qz=function(a){var b=this.D;if(!b.isEnabled)return!1;var c=kj(b,a,!0);null!==b.mouseEnter&&b.mouseEnter(c);return oj(b,c,a)};Q.prototype.Rz=function(a){var b=this.D;if(!b.isEnabled)return!1;var c=kj(b,a,!0);null!==b.mouseLeave&&b.mouseLeave(c);return oj(b,c,a)};
Q.prototype.getMouse=function(a){var b=this.Ia;if(null===b)return new K(0,0);var c=b.getBoundingClientRect();b=a.clientX-this.Ba/c.width*c.left;a=a.clientY-this.Aa/c.height*c.top;return null!==this.Ab?Kb(new K(b,a),this.Ab):new K(b,a)};
function lj(a,b,c){var d=a.Ia,e=a.Ba,f=a.Aa,g=0,h=0;null!==d&&(d=d.getBoundingClientRect(),g=b.clientX-e/d.width*d.left,h=b.clientY-f/d.height*d.top);c.viewPoint.h(g,h);null!==a.Ab?(b=K.allocAt(g,h),a.Ab.Od(b),c.documentPoint.assign(b),K.free(b)):c.documentPoint.h(g,h)}
function pe(a,b,c,d){if(void 0!==b.targetTouches){if(2>b.targetTouches.length)return;b=b.targetTouches[c]}else if(null!==a.Hl[0])b=a.Hl[c];else return;c=a.Ia;null!==c&&(c=c.getBoundingClientRect(),d.h(b.clientX-a.Ba/c.width*c.left,b.clientY-a.Aa/c.height*c.top))}Q.prototype.Wa=function(){this.vj||(this.vj=!0,this.Lb(!0))};function pj(a){a.cd||uh(a);a.Ya()}Q.prototype.redraw=function(){this.vb||this.cd||(this.R(),dj(this),this.od())};t=Q.prototype;t.FA=function(){return this.vg};
t.Lz=function(a){void 0===a&&(a=null);var b=this.animationManager,c=b.isEnabled;b.wc();b.isEnabled=!1;Hf(this);this.fg=!1;this.nu=new K(NaN,NaN);b.isEnabled=c;this.cd=!0;var d=this;null!==a&&va(function(){d.cd=!1;th(b,"Model");a(d)},1)};t.Lb=function(a){void 0===a&&(a=!1);if(!0!==this.vg&&!(this.vb||!1===a&&this.cd)){this.vg=!0;var b=this;sa.requestAnimationFrame(function(){b.vg&&b.od()})}};t.od=function(){if(!this.Mn||this.vg)this.Mn&&(this.Mn=!1),Hf(this)};
function ej(a,b,c){a.animationManager.defaultAnimation.isAnimating||a.vb||!a.wj||Xi(a)||(b&&uh(a),c&&aj(a,!1))}
function Hf(a,b){if(!a.cd&&(a.vg=!1,null!==a.La||a.Sp.s())){a.cd=!0;var c=a.animationManager,d=a.ap;if(!c.isAnimating&&0!==d.length){for(var e=d.m,f=e.length,g=0;g<f;g++){var h=e[g];qj(h,!1);h.v()}d.clear()}d=a.bx;0<d.count&&(d.each(function(a){a.kw()}),d.clear());e=d=!1;c.defaultAnimation.isAnimating&&(e=!0,d=a.skipsUndoManager,a.skipsUndoManager=!0);c.yb||Ah(a);ej(a,!1,!0);null!==a.de&&(a.de.visible&&!a.tr&&(rj(a),a.tr=!0),!a.de.visible&&a.tr&&(a.tr=!1));uh(a);f=!1;if(!a.fg||a.Zh)a.fg?sj(a,!a.bl):
(a.Ea("Initial Layout"),!1===c.isEnabled&&c.wc(),sj(a,!1)),f=!0;a.bl=!1;uh(a);a.uu||pj(a);ej(a,!0,!1);g=!1;f?(c=M.alloc(),c.assign(a.viewportBounds),a.fg||(g=a.fg=!0,a.skipsUndoManager||(a.undoManager.isPendingClear=!0),a.undoManager.isPendingUnmodified=!0,tj(a)),a.V("LayoutCompleted"),c.B(a.viewportBounds)||ej(a,!0,!1),M.free(c)):c.jl&&c.Cx&&(a.bh!==zh?a.scale=bj(a,a.bh):a.$h!==zh?a.scale=bj(a,a.$h):(c=a.initialScale,isFinite(c)&&0<c&&(a.scale=c)),aj(a,!0));uh(a);f&&g&&a.cb("Initial Layout");a.Nu();
b||a.uc(a.$b);e&&(a.skipsUndoManager=d);a.cd=!1}}function tj(a){var b=a.ya;if(a.bh!==zh)a.scale=bj(a,a.bh);else if(a.$h!==zh)a.scale=bj(a,a.$h);else{var c=a.initialScale;isFinite(c)&&0<c&&(a.scale=c)}a.ya!==b&&(dj(a),ej(a,!0,!1));aj(a,!0);b=a.Ua.m;a.Sd(b,b.length,a,a.viewportBounds);a.V("InitialLayoutCompleted");a.nu.assign(a.pa);rj(a)}
function uh(a){if(0!==a.De.count&&(a.cd||!a.animationManager.isTicking)){for(var b=0;23>b;b++){var c=a.De.iterator;if(null===c||0===a.De.count)break;a.De=new I;a.kw(c,a.De);G&&22===b&&Fa("failure to validate parts")}a.nodes.each(function(a){a instanceof yf&&0!==(a.U&65536)!==!1&&(a.U=a.U^65536)})}}
t.kw=function(a,b){for(a.reset();a.next();){var c=a.value;!c.Tc()||c instanceof yf||(c.cj()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c))}for(a.reset();a.next();)c=a.value,c instanceof yf&&c.isVisible()&&uj(this,c);for(a.reset();a.next();)c=a.value,c instanceof R&&c.isVisible()&&(c.cj()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c));for(a.reset();a.next();)c=a.value,c instanceof Ke&&c.isVisible()&&(c.cj()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c))};
function uj(a,b){for(var c=Na(),d=Na(),e=b.memberParts;e.next();){var f=e.value;f.isVisible()&&(f instanceof yf?(vj(f)||wj(f)||xj(f))&&uj(a,f):f instanceof R?f.fromNode===b||f.toNode===b?d.push(f):c.push(f):(f.measure(Infinity,Infinity),f.arrange()))}a=c.length;for(e=0;e<a;e++)f=c[e],f.measure(Infinity,Infinity),f.arrange();Pa(c);b.measure(Infinity,Infinity);b.arrange();a=d.length;for(b=0;b<a;b++)c=d[b],c.measure(Infinity,Infinity),c.arrange();Pa(d)}
t.Sd=function(a,b,c,d){if(this.xj||this.animationManager.isAnimating)for(var e=0;e<b;e++)a[e].Sd(c,d)};
t.uc=function(a,b){if(null!==this.La){null===this.Ia&&v("No canvas specified");var c=this.animationManager;if(!c.yb&&(!c.isAnimating||c.isTicking)){var d=new Date;yj(this);if("0"!==this.La.style.opacity){var e=a!==this.$b,f=this.Ua.m,g=f.length,h=this;this.Sd(f,g,h,h.viewportBounds);if(e)a.Oc(!0),Zi(this);else if(!this.bd&&void 0===b&&!c.isAnimating)return;g=this.pa;var k=this.ya,l=Math.round(g.x*k)/k,m=Math.round(g.y*k)/k;c=this.Ab;c.reset();1!==k&&c.scale(k);0===g.x&&0===g.y||c.translate(-l,-m);
k=this.jc;a.setTransform(k,0,0,k,0,0);a.clearRect(0,0,this.Ba,this.Aa);1!==this.rb&&(a.globalAlpha=this.rb);G&&G.gm&&G.Wu&&(a.setTransform(c.m11*k,c.m12*k,c.m21*k,c.m22*k,c.dx,c.dy),G.Wu(this,a));zj(this,a);l=void 0!==b?function(c){if(c.visible&&0!==c.rb){var d=c.Ma.m,e=d.length;if(0!==e){var f=oi(c,a),g=c.Wo;g.length=0;for(var k=h.scale,l=M.alloc(),m=0;m<e;m++){var n=d[m];b.contains(n)||c.Oi(a,n,h,g,k,l,!0)}M.free(l);a.globalAlpha=f}}}:function(b){b.uc(a,h)};g=f.length;for(m=0;m<g;m++)a.setTransform(k,
0,0,k,0,0),a.transform(c.m11,c.m12,c.m21,c.m22,c.dx,c.dy),l(f[m]);f=!1;this.ji?Aj(this.ji,this)&&(f=this.Mt()):f=!0;f&&(Jb.prototype.Od=Jb.prototype.Nx);G&&(G.Zx||G.gm)&&G.Xu&&G.Xu(a,this,c);e?(this.$b.Oc(!0),Zi(this)):this.bd=this.xj=!1;f=+new Date-+d;e=G&&G.Yx;d=this.lx;if(e||null===this.Di){d[this.Nr]=f;this.Nr=(this.Nr+1)%d.length;for(c=f=0;c<d.length;c++)f+=d[c];this.Mr=f/d.length}1!==this.rb&&(a.globalAlpha=1);if(e)for(a.setTransform(1,0,0,1,0,0),e=0;e<d.length;e++)a.fillText(d[e].toString(),
20,150+ +(20*e))}}}};
function Bj(a,b,c,d,e,f,g,h,k,l){if(null!==a.La){null===a.Ia&&v("No canvas specified");void 0===g&&(g=null);void 0===h&&(h=null);void 0===k&&(k=!1);void 0===l&&(l=!1);yj(a);a.$b.Oc(!0);Zi(a);a.zj=!0;var m=a.ya;a.ya=e;var n=a.Ua.m,p=n.length;try{var r=new M(f.x,f.y,d.width/e,d.height/e),q=r.copy();q.Yp(c);rj(a,q);uh(a);a.Sd(n,p,a,r);b.setTransform(1,0,0,1,0,0);b.clearRect(0,0,d.width,d.height);null!==h&&""!==h&&(b.fillStyle=h,b.fillRect(0,0,d.width,d.height));var u=a.jc;b.scale(u,u);var x=Jb.alloc();
x.reset();x.translate(c.left,c.top);x.scale(e);0===f.x&&0===f.y||x.translate(-f.x,-f.y);b.setTransform(x.m11,x.m12,x.m21,x.m22,x.dx,x.dy);Jb.free(x);zj(a,b);b.globalAlpha=a.rb;var y=a.ik("Grid");if(g){var z=new I,B=g.iterator;for(B.reset();B.next();){var D=B.value;D instanceof U&&(l||D.layer!==y)&&z.add(D)}for(l=0;l<p;l++){var C=n[l];y=b;var J=a;if(C.visible&&0!==C.rb&&(k||!C.isTemporary)){var S=C.Ma.m,T=S.length;if(0!==T){var aa=oi(C,y),W=C.Wo;W.length=0;var P=J.scale,qa=M.alloc();for(c=0;c<T;c++){var ia=
S[c];z.contains(ia)&&C.Oi(y,ia,J,W,P,qa,!1)}M.free(qa);y.globalAlpha=aa}}}}else for(z=0;z<p;z++)J=n[z],J===y?l&&J.uc(b,a,!0):J.uc(b,a,k);a.zj=!1;a.ji&&Aj(a.ji,a)&&a.Mt()}finally{a.ya=m,a.$b.Oc(!0),Zi(a),a.Sd(n,p,a,a.viewportBounds),rj(a)}}}t.Ve=function(a){return this.sh[a]};t.My=function(a,b){"minDrawingLength"===a&&(this.Jr=b);this.sh[a]=b;this.redraw()};
t.Iy=function(){this.sh=new fb;this.sh.drawShadows=!0;this.sh.textGreeking=!0;this.sh.viewportOptimizations=$a||Xa?!1:!0;this.sh.temporaryPixelRatio=!0;this.sh.pictureRatioOptimization=!0;this.Jr=this.sh.minDrawingLength=1};function zj(a,b){a=a.sh;null!==a&&(void 0!==a.imageSmoothingEnabled&&b.Ly(!!a.imageSmoothingEnabled),a=a.defaultFont,void 0!==a&&null!==a&&(b.font=a))}t.om=function(a){return this.bo[a]};t.gB=function(a,b){this.bo[a]=b};
t.Hy=function(){this.bo=new fb;this.bo.extraTouchArea=10;this.bo.extraTouchThreshold=10;this.bo.hasGestureZoom=!0};t.set=function(a){if(G)for(var b in a)(b.startsWith("_")||-1!==b.indexOf("."))&&v("Property with underscore or period passed to Diagram.set. Did you mean to use Diagram.assign?");Object.assign(this,a);return this};t.Ju=function(a){return this.Lm(a)};t.Lm=function(a){Cj(this,a);return this};
function Cj(a,b){var c=a instanceof X,d=a instanceof Q,e;for(e in b){""===e&&v("Setting properties requires non-empty property names");var f=a,g=e;if(c||d){var h=e.indexOf(".");if(0<h){var k=e.substring(0,h);if(c)f=a.eb(k);else if(f=a[k],void 0===f||null===f)f=a.toolManager[k];Ga(f)?g=e.substr(h+1):v("Unable to find object named: "+k+" in "+a.toString()+" when trying to set property: "+e)}}if("_"!==g[0]&&!Sa(f,g))if(d&&"ModelChanged"===g){a.Kx(b[g]);continue}else if(d&&"Changed"===g){a.Jh(b[g]);continue}else if(d&&
Sa(a.toolManager,g))f=a.toolManager;else if(d&&Dj(a,g)){a.Xj(g,b[g]);continue}else if(a instanceof Y&&"Changed"===g){a.Jh(b[g]);continue}else v('Trying to set undefined property "'+g+'" on object: '+f.toString());f[g]=b[e];"_"===g[0]&&f instanceof O&&f.Hx(g)}}t.Nu=function(){if(0===this.undoManager.transactionLevel&&0!==this.hi.count){for(;0<this.hi.count;){var a=this.hi;this.hi=new yb;for(a=a.iterator;a.next();){var b=a.key;b.rq(a.value);b.lc(!1)}}this.R()}};
t.R=function(a){if(void 0===a)this.bd=!0,this.Lb();else{var b=this.viewportBounds;a.s()&&b.Sc(a)&&(this.bd=!0,this.Lb())}this.V("InvalidateDraw")};
Q.prototype.invalidateViewport=function(a,b){if(!0!==this.bd){this.bd=!0;var c=!0===this.Ve("temporaryPixelRatio");if(!0===this.Ve("viewportOptimizations")&&this.scrollMode!==bi&&this.Rj.Qi(0,0,0,0)&&b.width===a.width&&b.height===a.height){var d=this.scale,e=Math.max(a.x,b.x),f=Math.max(a.y,b.y);d=M.allocAt(e,f,Math.max(0,Math.min(a.x+a.width,b.x+b.width)-e)*d,Math.max(0,Math.min(a.y+a.height,b.y+b.height)-f)*d);if(!this.ns&&0<d.width&&0<d.height){if(!(this.cd||(this.vg=!1,null===this.La||(this.cd=
!0,this.Nu(),this.documentBounds.s()||(e=M.alloc(),Ej(this,this.computeBounds(e)),M.free(e)),e=this.Ia,null===e||e instanceof Fj)))){var g=this.jc;f=this.Ba*g;var h=this.Aa*g,k=this.scale*g,l=Math.round(Math.round(b.x*k)-Math.round(a.x*k));b=Math.round(Math.round(b.y*k)-Math.round(a.y*k));k=this.Ww;a=this.cz;k.width!==f&&(k.width=f);k.height!==h&&(k.height=h);a.clearRect(0,0,f,h);k=190*g;var m=70*g,n=Math.max(l,0),p=Math.max(b,0),r=Math.floor(f-n),q=Math.floor(h-p);a.drawImage(e.Qa,n,p,r,q,0,0,r,
q);Aj(this.ji,this)&&a.clearRect(0,0,k,m);e=Na();a=Na();q=Math.abs(l);r=Math.abs(b);var u=0===n?0:f-q;n=K.allocAt(u,0);q=K.allocAt(q+u,h);a.push(new M(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y)));var x=this.Ab;x.reset();x.scale(g,g);1!==this.ya&&x.scale(this.ya);g=this.pa;(0!==g.x||0!==g.y)&&isFinite(g.x)&&isFinite(g.y)&&x.translate(-g.x,-g.y);Kb(n,x);Kb(q,x);e.push(new M(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y)));u=0===p?0:h-r;n.h(0,u);
q.h(f,r+u);a.push(new M(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y)));Kb(n,x);Kb(q,x);e.push(new M(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y)));Aj(this.ji,this)&&(f=0<l?0:-l,h=0<b?0:-b,n.h(f,h),q.h(k+f,m+h),a.push(new M(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y))),Kb(n,x),Kb(q,x),e.push(new M(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y))));K.free(n);K.free(q);ej(this,!1,!0);null===this.La&&
v("No div specified");null===this.Ia&&v("No canvas specified");if(!this.animationManager.yb&&(f=this.$b,this.bd)){yj(this);h=this.jc;f.setTransform(1,0,0,1,0,0);f.clearRect(0,0,this.Ba*h,this.Aa*h);f.drawImage(this.Ww.Qa,0<l?0:Math.round(-l),0<b?0:Math.round(-b));b=this.pa;g=this.ya;k=Math.round(b.x*g)/g;m=Math.round(b.y*g)/g;l=this.Ab;l.reset();1!==g&&l.scale(g);0===b.x&&0===b.y||l.translate(-k,-m);f.save();f.beginPath();b=a.length;for(g=0;g<b;g++)k=a[g],0!==k.width&&0!==k.height&&f.rect(Math.floor(k.x),
Math.floor(k.y),Math.ceil(k.width),Math.ceil(k.height));f.clip();f.setTransform(1,0,0,1,0,0);f.scale(h,h);f.transform(l.m11,l.m12,l.m21,l.m22,l.dx,l.dy);G&&G.gm&&G.Wu&&G.Wu(this,f);h=this.Ua.m;b=h.length;this.Sd(h,b,this,this.viewportBounds);zj(this,f);f.globalAlpha=this.rb;for(g=0;g<b;g++)if(k=h[g],m=e,k.visible&&0!==k.rb){p=oi(k,f);n=k.Wo;n.length=0;r=this.scale;q=M.alloc();x=k.Ma.m;u=x.length;for(var y=m.length,z=0;z<u;z++){var B=x[z];a:{var D=Gj(B,B.actualBounds);for(var C=m,J=y,S=2/r,T=4/r,aa=
0;aa<J;aa++){var W=C[aa];if(0!==W.width&&0!==W.height&&D.pv(W.x-S,W.y-S,W.width+T,W.height+T)){D=!0;break a}}D=!1}D&&k.Oi(f,B,this,n,r,q,!0)}M.free(q);f.globalAlpha=p}f.restore();f.Oc(!0);G&&(G.Zx||G.gm)&&G.Xu&&G.Xu(f,this,l);this.ji&&Aj(this.ji,this)&&this.Mt();this.bd=this.xj=!1;this.Bq()}Pa(e);Pa(a);this.cd=!1}}else this.od();M.free(d);c&&($e(this),this.od(),kf(this,!0))}else c?($e(this),this.od(),kf(this,!0)):this.od()}};function dj(a){!1===a.wj&&(a.wj=!0)}
function Zi(a){!1===a.xj&&(a.xj=!0)}function yj(a){!1!==a.co&&(a.co=!1,Hj(a,a.Ba,a.Aa))}function Hj(a,b,c){Li(a);var d=a.jc;a.Ia.resize(b*d,c*d,b,c)&&(a.bd=!0,a.$b.Oc(!0))}
function Xi(a){var b=a.Ia;if(null===b||a.Sp.s())return!0;var c=a.Ba,d=a.Aa,e=a.viewportBounds;if(!a.viewportBounds.s())return!0;var f=e.x,g=e.y,h=e.width,k=e.height,l=a.su,m=a.qu,n=a.La,p=!1,r=a.dg?a.zb:0,q=a.kf?a.zb:0,u=n.clientWidth||c+r,x=n.clientHeight||d+q;if(u!==c+r||x!==d+q)a.dg=!1,a.kf=!1,q=r=0,a.Ba=u,a.Aa=x,p=a.co=!0,Li(a);if(!(p||a.dg||a.kf||a.Zn||a.$n))return!0;a.wj=!1;var y=a.documentBounds,z=0,B=0,D=0,C=0;n=e.width;var J=e.height,S=a.Rj;a.contentAlignment.fb()?(y.width>n&&(z=S.left,B=
S.right),y.height>J&&(D=S.top,C=S.bottom)):(z=S.left,B=S.right,D=S.top,C=S.bottom);S=y.width+z+B;var T=y.height+D+C;z=y.x-z;var aa=e.x;B=y.right+B;var W=e.right+r;D=y.y-D;var P=e.y;y=y.bottom+C;C=e.bottom+q;var qa="1px",ia="1px";e=a.scale;u=S>u/e;x=T>x/e;a.scrollMode===$h&&(u||x)&&(u&&a.hasHorizontalScrollbar&&a.allowHorizontalScroll&&(u=1,z+1<aa&&(u=Math.max((aa-z)*e+a.Ba,u)),B>W+1&&(u=Math.max((B-W)*e+a.Ba,u)),n+r+1<S&&(u=Math.max((S-n)*e+a.Ba,u)),qa=u.toString()+"px"),x&&a.hasVerticalScrollbar&&
a.allowVerticalScroll&&(u=1,D+1<P&&(u=Math.max((P-D)*e+a.Aa,u)),y>C+1&&(u=Math.max((y-C)*e+a.Aa,u)),J+q+1<T&&(u=Math.max((T-J)*e+a.Aa,u)),ia=u.toString()+"px"));u="1px"!==qa;x="1px"!==ia;u&&x||!u&&!x||(x&&(W-=a.zb),u&&(C-=a.zb),S<n+r||!a.hasHorizontalScrollbar||!a.allowHorizontalScroll||(r=1,z+1<aa&&(r=Math.max((aa-z)*e+a.Ba,r)),B>W+1&&(r=Math.max((B-W)*e+a.Ba,r)),n+1<S&&(r=Math.max((S-n)*e+a.Ba,r)),qa=r.toString()+"px"),u="1px"!==qa,r=a.Aa,u!==a.kf&&(r=u?a.Aa-a.zb:a.Aa+a.zb),T<J+q||!a.hasVerticalScrollbar||
!a.allowVerticalScroll||(q=1,D+1<P&&(q=Math.max((P-D)*e+r,q)),y>C+1&&(q=Math.max((y-C)*e+r,q)),J+1<T&&(q=Math.max((T-J)*e+r,q)),ia=q.toString()+"px"),x="1px"!==ia);if(a.$r&&u===a.kf&&x===a.dg)return c===a.Ba&&d===a.Aa||a.od(),!1;u!==a.kf&&("1px"===qa?a.Aa=a.Aa+a.zb:a.Aa=Math.max(a.Aa-a.zb,1),p=!0);a.kf=u;m.style.width=qa;x!==a.dg&&("1px"===ia?a.Ba=a.Ba+a.zb:a.Ba=Math.max(a.Ba-a.zb,1),p=!0,a.jo&&(q=K.alloc(),x?(b.style.left=a.zb+"px",a.position=q.h(a.pa.x+a.zb/a.scale,a.pa.y)):(b.style.left="0px",
a.position=q.h(a.pa.x-a.zb/a.scale,a.pa.y)),K.free(q)));p&&Li(a);a.dg=x;m.style.height=ia;a.pu=!0;p&&(a.co=!0);b=l.scrollLeft;a.hasHorizontalScrollbar&&a.allowHorizontalScroll&&(n+1<S?b=(a.position.x-z)*e:z+1<aa?b=l.scrollWidth-l.clientWidth:B>W+1&&(b=a.position.x*e));if(a.jo)switch(a.lu){case "negative":b=-(l.scrollWidth-b-l.clientWidth);break;case "reverse":b=l.scrollWidth-b-l.clientWidth}l.scrollLeft=b;a.hasVerticalScrollbar&&a.allowVerticalScroll&&(J+1<T?l.scrollTop=(a.position.y-D)*e:D+1<P?l.scrollTop=
l.scrollHeight-l.clientHeight:y>C+1&&(l.scrollTop=a.position.y*e));u=a.Ba;x=a.Aa;l.style.width=u+(a.dg?a.zb:0)+"px";l.style.height=x+(a.kf?a.zb:0)+"px";return c!==u||d!==x||a.animationManager.yb?(c=M.allocAt(f,g,h,k),a.onViewportBoundsChanged(c,a.viewportBounds,e,p),M.free(c),!1):!0}t=Q.prototype;
t.add=function(a){w(a,U,Q,"add:part");var b=a.diagram;if(b!==this&&(null!==b&&v("Cannot add part "+a.toString()+" to "+this.toString()+". It is already a part of "+b.toString()),b=this.ik(a.layerName),null===b&&(b=this.ik("")),null===b&&v('Cannot add a Part when unable find a Layer named "'+a.layerName+'" and there is no default Layer'),a.layer!==b)){var c=b.Yi(99999999,a,a.diagram===this);0<=c&&this.bb(ue,"parts",b,null,a,null,c);b.isTemporary||this.Wa();a.C(1);c=a.layerChanged;null!==c&&c(a,null,
b)}};t.Yi=function(a){this.partManager.Yi(a);var b=this;Ij(a,function(a){Jj(b,a)});(a instanceof Ke||a instanceof yf&&null!==a.placeholder)&&a.v();null!==a.data&&Ij(a,function(a){Kj(b.partManager,a)});!0!==wj(a)&&!0!==xj(a)||this.De.add(a);Lj(a,!0,this);Mj(a)?(a.actualBounds.s()&&this.R(Gj(a,a.actualBounds)),this.Wa()):a.isVisible()&&a.actualBounds.s()&&this.R(Gj(a,a.actualBounds));this.Lb()};
t.kc=function(a){a.$j();this.partManager.kc(a);var b=this;null!==a.data&&Ij(a,function(a){Nj(b.partManager,a,b)});this.De.remove(a);Mj(a)?(a.actualBounds.s()&&this.R(Gj(a,a.actualBounds)),this.Wa()):a.isVisible()&&a.actualBounds.s()&&this.R(Gj(a,a.actualBounds));this.Lb()};t.remove=function(a){w(a,U,Q,"remove:part");Oj(this,a,!0)};
function Oj(a,b,c){var d=b.layer;null!==d&&d.diagram===a&&(b.isSelected=!1,b.isHighlighted=!1,b.C(2),c&&b.fk(),c=d.kc(-1,b,!1),0<=c&&a.bb(ve,"parts",d,b,null,c,null),a=b.layerChanged,null!==a&&a(b,d,null))}t.bt=function(a,b){void 0===b&&(b=!1);if(Ha(a))for(var c=a.length,d=0;d<c;d++){var e=a[d];b&&!e.canDelete()||this.remove(e)}else for(c=new I,c.addAll(a),a=c.iterator;a.next();)c=a.value,b&&!c.canDelete()||this.remove(c)};t.ek=function(a,b,c){void 0===c&&(c=!1);return this.partManager.ek(a,b,c)};
Q.prototype.moveParts=function(a,b,c,d){void 0===c&&(c=!1);void 0===d&&(d=Pj(this));w(b,K,Q,"moveParts:offset");if(null!==this.toolManager){var e=new yb;if(null!==a)if(Ha(a))for(var f=0;f<a.length;f++)Qj(this,e,a[f],c,d);else for(a=a.iterator;a.next();)Qj(this,e,a.value,c,d);else{for(a=this.parts;a.next();)Qj(this,e,a.value,c,d);for(a=this.nodes;a.next();)Qj(this,e,a.value,c,d);for(a=this.links;a.next();)Qj(this,e,a.value,c,d)}vf(this,e,b,d,c)}};
function Qj(a,b,c,d,e,f){if(!b.contains(c)&&(void 0===f&&(f=!1),!d||f||c.canMove()||c.canCopy()))if(void 0===e&&(e=Pj(a)),c instanceof V){b.add(c,a.Hd(e,c,c.location));if(c instanceof yf&&(null!==c.placeholder||e.dragsMembers))for(f=c.memberParts;f.next();)Qj(a,b,f.value,d,e,e.groupsAlwaysMove);for(f=c.linksConnected;f.next();){var g=f.value;if(!b.contains(g)){var h=g.fromNode,k=g.toNode;null!==h&&b.contains(h)&&null!==k&&b.contains(k)&&Qj(a,b,g,d,e)}}if(e.dragsTree)for(c=c.fv();c.next();)Qj(a,b,
c.value,d,e)}else if(c instanceof R)for(b.add(c,a.Hd(e,c)),c=c.labelNodes;c.next();)Qj(a,b,c.value,d,e);else c instanceof Ke||b.add(c,a.Hd(e,c,c.location))}
function vf(a,b,c,d,e){if(null!==b&&(w(b,yb,Q,"moveParts:parts"),0!==b.count)){var f=K.alloc(),g=K.alloc();g.assign(c);isNaN(g.x)&&(g.x=0);isNaN(g.y)&&(g.y=0);(c=a.ms)||af(a,b);for(var h=Na(),k=Na(),l=b.iterator,m=K.alloc();l.next();){var n=l.key,p=l.value;if(n.Tc()){var r=Rj(a,n,b);if(null!==r)h.push(new Sj(n,p,r));else if(!e||n.canMove())r=p.point,f.assign(r),a.computeMove(n,f.add(g),d,m),n.location=m,void 0===p.shifted&&(p.shifted=new K),p.shifted.assign(m.qe(r))}else l.key instanceof R&&k.push(l.qa)}K.free(m);
e=h.length;for(l=0;l<e;l++)n=h[l],f.assign(n.info.point),void 0===n.kv.shifted&&(n.kv.shifted=new K),n.node.location=f.add(n.kv.shifted);e=K.alloc();l=K.alloc();n=k.length;for(p=0;p<n;p++){var q=k[p];r=q.key;if(r instanceof R)if(r.suspendsRouting){r.uf=null;m=r.fromNode;var u=r.toNode;if(null!==a.draggedLink&&d.dragsLink)if(u=q.value.point,null===r.dragComputation)b.add(r,a.Hd(d,r,g)),pf(r,g.x-u.x,g.y-u.y);else{q=K.allocAt(0,0);(m=r.i(0))&&m.s()&&q.assign(m);var x=m=K.alloc().assign(q).add(g);d.isGridSnapEnabled&&
(d.isGridSnapRealtime||a.lastInput.up)&&(x=K.alloc(),Ig(a,r,m,x,d));m.assign(r.dragComputation(r,m,x)).qe(q);b.add(r,a.Hd(d,r,m));pf(r,m.x-u.x,m.y-u.y);K.free(q);K.free(m);x!==m&&K.free(x)}else null!==m&&(e.assign(m.location),x=b.K(m),null!==x&&e.qe(x.point)),null!==u&&(l.assign(u.location),x=b.K(u),null!==x&&l.qe(x.point)),null!==m&&null!==u?e.Za(l)?(m=q.value.point,u=f,u.assign(e),u.qe(m),b.add(r,a.Hd(d,r,e)),pf(r,u.x,u.y)):(r.suspendsRouting=!1,r.$a()):(q=q.value.point,m=null!==m?e:null!==u?l:
g,b.add(r,a.Hd(d,r,m)),pf(r,m.x-q.x,m.y-q.y))}else if(null===r.fromNode||null===r.toNode)m=q.value.point,b.add(r,a.Hd(d,r,g)),pf(r,g.x-m.x,g.y-m.y)}K.free(f);K.free(g);K.free(e);K.free(l);Pa(h);Pa(k);c||(uh(a),ff(a,b))}}
Q.prototype.computeMove=function(a,b,c,d){void 0===d&&(d=new K);d.assign(b);if(null===a)return d;var e=b,f=c.isGridSnapEnabled;f&&(c.isGridSnapRealtime||this.lastInput.up)&&(e=K.alloc(),Ig(this,a,b,e,c));c=null!==a.dragComputation?a.dragComputation(a,b,e):e;var g=a.minLocation,h=g.x;isNaN(h)&&(h=f?Math.round(1E3*a.location.x)/1E3:a.location.x);g=g.y;isNaN(g)&&(g=f?Math.round(1E3*a.location.y)/1E3:a.location.y);var k=a.maxLocation,l=k.x;isNaN(l)&&(l=f?Math.round(1E3*a.location.x)/1E3:a.location.x);
k=k.y;isNaN(k)&&(k=f?Math.round(1E3*a.location.y)/1E3:a.location.y);d.h(Math.max(h,Math.min(c.x,l)),Math.max(g,Math.min(c.y,k)));e!==b&&K.free(e);return d};function Pj(a){var b=a.toolManager.findTool("Dragging");return null!==b?b.dragOptions:a.Bn}
function Ig(a,b,c,d,e){void 0===e&&(e=Pj(a));d.assign(c);if(null!==b){var f=a.grid;b=e.gridSnapCellSize;a=b.width;b=b.height;var g=e.gridSnapOrigin,h=g.x;g=g.y;e=e.gridSnapCellSpot;if(null!==f){var k=f.gridCellSize;isNaN(a)&&(a=k.width);isNaN(b)&&(b=k.height);f=f.gridOrigin;isNaN(h)&&(h=f.x);isNaN(g)&&(g=f.y)}f=K.allocAt(0,0);f.fj(0,0,a,b,e);L.jq(c.x,c.y,h+f.x,g+f.y,a,b,d);K.free(f)}}function af(a,b){if(null!==b)for(a.ms=!0,a=b.iterator;a.next();)b=a.key,b instanceof R&&(b.suspendsRouting=!0)}
function ff(a,b){if(null!==b){for(b=b.iterator;b.next();){var c=b.key;c instanceof R&&(c.suspendsRouting=!1,Tj(c)&&c.$a())}a.ms=!1}}function Rj(a,b,c){b=b.containingGroup;if(null!==b){a=Rj(a,b,c);if(null!==a)return a;a=c.K(b);if(null!==a)return a}return null}t=Q.prototype;t.Hd=function(a,b,c){if(void 0===c)return new df(zb);var d=a.isGridSnapEnabled;a.groupsSnapMembers||null===b.containingGroup||(d=!1);return d?new df(new K(Math.round(1E3*c.x)/1E3,Math.round(1E3*c.y)/1E3)):new df(c.copy())};
function Uj(a,b,c){w(b,mi,Q,"addLayer:layer");null!==b.diagram&&b.diagram!==a&&v("Cannot share a Layer with another Diagram: "+b+" of "+b.diagram);null===c?null!==b.diagram&&v("Cannot add an existing Layer to this Diagram again: "+b):(w(c,mi,Q,"addLayer:existingLayer"),c.diagram!==a&&v("Existing Layer must be in this Diagram: "+c+" not in "+c.diagram),b===c&&v("Cannot move a Layer before or after itself: "+b));if(b.diagram!==a){b=b.name;a=a.Ua;c=a.count;for(var d=0;d<c;d++)a.M(d).name===b&&v("Cannot add Layer with the name '"+
b+"'; a Layer with the same name is already present in this Diagram.")}}t.em=function(a){Uj(this,a,null);a.$e(this);var b=this.Ua,c=b.count-1;if(!a.isTemporary)for(;0<=c&&b.M(c).isTemporary;)c--;b.Bb(c+1,a);null!==this.ac&&this.bb(ue,"layers",this,null,a,null,c+1);this.R();this.Wa();return this};
t.Ix=function(a,b){Uj(this,a,b);a.$e(this);var c=this.Ua,d=c.indexOf(a);0<=d&&(c.remove(a),null!==this.ac&&this.bb(ve,"layers",this,a,null,d,null));var e=c.count,f;for(f=0;f<e;f++)if(c.M(f)===b){c.Bb(f,a);break}null!==this.ac&&this.bb(ue,"layers",this,null,a,null,f);this.R();0>d&&this.Wa();return this};
t.oz=function(a,b){Uj(this,a,b);a.$e(this);var c=this.Ua,d=c.indexOf(a);0<=d&&(c.remove(a),null!==this.ac&&this.bb(ve,"layers",this,a,null,d,null));var e=c.count,f;for(f=0;f<e;f++)if(c.M(f)===b){c.Bb(f+1,a);break}null!==this.ac&&this.bb(ue,"layers",this,null,a,null,f+1);this.R();0>d&&this.Wa();return this};
t.ZA=function(a){w(a,mi,Q,"removeLayer:layer");a.diagram!==this&&v("Cannot remove a Layer from another Diagram: "+a+" of "+a.diagram);if(""!==a.name){var b=this.Ua,c=b.indexOf(a);if(b.remove(a)){for(b=a.Ma.copy().iterator;b.next();){var d=b.value,e=d.layerName;e!==a.name?d.layerName=e:d.layerName=""}null!==this.ac&&this.bb(ve,"layers",this,a,null,c,null);this.R();this.Wa()}}};t.ik=function(a){for(var b=this.layers;b.next();){var c=b.value;if(c.name===a)return c}return null};
t.Kx=function(a){A(a,"function",Q,"addModelChangedListener:listener");null===this.rf&&(this.rf=new H);this.rf.add(a);this.model.Jh(a);return this};t.aB=function(a){A(a,"function",Q,"removeModelChangedListener:listener");null!==this.rf&&(this.rf.remove(a),0===this.rf.count&&(this.rf=null));this.model.Ak(a)};t.Jh=function(a){A(a,"function",Q,"addChangedListener:listener");null===this.Lg&&(this.Lg=new H);this.Lg.add(a);return this};
t.Ak=function(a){A(a,"function",Q,"removeChangedListener:listener");null!==this.Lg&&(this.Lg.remove(a),0===this.Lg.count&&(this.Lg=null))};t.ws=function(a){this.skipsUndoManager||this.model.skipsUndoManager||this.model.undoManager.mv(a);a.change!==te&&(this.isModified=!0);if(null!==this.Lg)for(var b=this.Lg,c=b.length,d=0;d<c;d++)b.M(d)(a)};
t.bb=function(a,b,c,d,e,f,g){void 0===f&&(f=null);void 0===g&&(g=null);var h=new re;h.diagram=this;h.change=a;h.propertyName=b;h.object=c;h.oldValue=d;h.oldParam=f;h.newValue=e;h.newParam=g;this.ws(h)};t.g=function(a,b,c,d,e){this.bb(se,a,this,b,c,d,e)};
Q.prototype.changeState=function(a,b){if(null!==a&&a.diagram===this){var c=this.skipsModelSourceBindings;try{this.skipsModelSourceBindings=!0;var d=a.change;if(d===se){var e=a.object;Vj(e,a.propertyName,a.K(b));if(e instanceof O){var f=e.part;null!==f&&f.Rb()}this.isModified=!0}else if(d===ue){var g=a.object,h=a.newParam,k=a.newValue;if(g instanceof X)if("number"===typeof h&&k instanceof O){b?g.kc(h):g.Bb(h,k);var l=g.part;null!==l&&l.Rb()}else"number"===typeof h&&k instanceof Wj&&(k.isRow?Xj(g,h,
b?void 0:k):Yj(g,h,b?void 0:k));else if(g instanceof mi){var m=!0===a.oldParam;"number"===typeof h&&k instanceof U&&(b?(k.isSelected=!1,k.isHighlighted=!1,k.Rb(),g.kc(m?h:-1,k,m)):g.Yi(h,k,m))}else g instanceof Q?"number"===typeof h&&k instanceof mi&&(b?this.Ua.kb(h):(k.$e(this),this.Ua.Bb(h,k))):v("unknown ChangedEvent.Insert object: "+a.toString());this.isModified=!0}else if(d===ve){var n=a.object,p=a.oldParam,r=a.oldValue;if(n instanceof X)"number"===typeof p&&r instanceof O?b?n.Bb(p,r):n.kc(p):
"number"===typeof p&&r instanceof Wj&&(r.isRow?Xj(n,p,b?r:void 0):Yj(n,p,b?r:void 0));else if(n instanceof mi){var q=!0===a.newParam;"number"===typeof p&&r instanceof U&&(b?0>n.Ma.indexOf(r)&&n.Yi(p,r,q):(r.isSelected=!1,r.isHighlighted=!1,r.Rb(),n.kc(q?p:-1,r,q)))}else n instanceof Q?"number"===typeof p&&r instanceof mi&&(b?(r.$e(this),this.Ua.Bb(p,r)):this.Ua.kb(p)):v("unknown ChangedEvent.Remove object: "+a.toString());this.isModified=!0}else d!==te&&v("unknown ChangedEvent: "+a.toString())}finally{this.skipsModelSourceBindings=
c}}};Q.prototype.Ea=function(a){return this.undoManager.Ea(a)};Q.prototype.cb=function(a){return this.undoManager.cb(a)};Q.prototype.Tf=function(){return this.undoManager.Tf()};Q.prototype.commit=function(a,b){void 0===b&&(b="");var c=this.skipsUndoManager;null===b&&(this.skipsUndoManager=!0,b="");this.undoManager.Ea(b);var d=!1;try{a(this),d=!0}finally{d?this.undoManager.cb(b):this.undoManager.Tf(),this.skipsUndoManager=c}};Q.prototype.updateAllTargetBindings=function(a){this.partManager.updateAllTargetBindings(a)};
Q.prototype.Mq=function(){this.partManager.Mq()};
function Zj(a,b,c){var d=a.animationManager;if(a.vb||a.cd)a.ya=c,Li(a),d.yb&&d.Yd.add(d.D,"scale",b,a.ya);else if(null===a.Ia)a.ya=c,Li(a);else{a.vb=!0;var e=a.viewportBounds.copy(),f=a.Ba,g=a.Aa;e.width=a.Ba/b;e.height=a.Aa/b;var h=a.zoomPoint.x,k=a.zoomPoint.y,l=a.contentAlignment;isNaN(h)&&(l.Uc()?l.Pf(Pc)?h=0:l.Pf(Qc)&&(h=f-1):h=l.fb()?l.x*(f-1):f/2);isNaN(k)&&(l.Uc()?l.Pf(Oc)?k=0:l.Pf(Rc)&&(k=g-1):k=l.fb()?l.y*(g-1):g/2);null===a.scaleComputation||a.animationManager.defaultAnimation.isAnimating||
(c=a.scaleComputation(a,c));c<a.minScale&&(c=a.minScale);c>a.maxScale&&(c=a.maxScale);f=K.allocAt(a.pa.x+h/b-h/c,a.pa.y+k/b-k/c);a.position=f;K.free(f);a.ya=c;Li(a);a.onViewportBoundsChanged(e,a.viewportBounds,b,!1);a.vb=!1;aj(a,!1);d.yb&&d.Yd.add(d.D,"scale",b,a.ya);a.R();dj(a)}}
Q.prototype.onViewportBoundsChanged=function(a,b,c,d){if(!a.B(b)){void 0===d&&(d=!1);d||dj(this);Zi(this);var e=this.layout;null===e||!e.isViewportSized||this.autoScale!==zh||d||a.width===b.width&&a.height===b.height||e.C();e=this.currentTool;!0===this.pl&&e instanceof Va&&(this.lastInput.documentPoint=this.jt(this.lastInput.viewPoint),Oe(e,this));this.vb||this.invalidateViewport(a,b);rj(this);this.ld.scale=c;this.ld.position.x=a.x;this.ld.position.y=a.y;this.ld.bounds.assign(a);this.ld.Ox.width=
Math.round(a.width*c);this.ld.Ox.height=Math.round(a.height*c);this.ld.Ay.width=this.Ba;this.ld.Ay.height=this.Aa;this.ld.vy=d;this.V("ViewportBoundsChanged",this.ld,a);this.isVirtualized&&this.links.each(function(a){a.isAvoiding&&a.actualBounds.Sc(b)&&a.$a()})}};
function rj(a,b){var c=a.de;if(null!==c&&c.visible){for(var d=Hb.alloc(),e=1,f=1,g=c.W.m,h=g.length,k=0;k<h;k++){var l=g[k],m=Math.abs(l.interval);2>m||(ak(l.figure)?f=f*m/L.hy(f,m):e=e*m/L.hy(e,m))}g=c.gridCellSize;d.h(f*g.width,e*g.height);if(void 0!==b)e=b.width,f=b.height,a=b.x,g=b.y;else{b=M.alloc();a=a.viewportBounds;b.h(a.x,a.y,a.width,a.height);if(!b.s()){M.free(b);return}e=b.width;f=b.height;a=b.x;g=b.y;M.free(b)}c.width=e+2*d.width;c.height=f+2*d.height;b=K.alloc();L.jq(a,g,0,0,d.width,
d.height,b);b.offset(-d.width,-d.height);Hb.free(d);c.part.location=b;K.free(b)}}Q.prototype.clearSelection=function(a){void 0===a&&(a=!1);var b=this.selection;if(0!==b.count){a||this.V("ChangingSelection",b);for(var c=b.Fa(),d=c.length,e=0;e<d;e++)c[e].isSelected=!1;b.ka();b.clear();b.freeze();a||this.V("ChangedSelection",b)}};
Q.prototype.select=function(a){null!==a&&(w(a,U,Q,"select:part"),a.diagram===this&&(!a.isSelected||1<this.selection.count)&&(this.V("ChangingSelection",this.selection),this.clearSelection(!0),a.isSelected=!0,this.V("ChangedSelection",this.selection)))};
Q.prototype.fB=function(a){this.V("ChangingSelection",this.selection);this.clearSelection(!0);if(Ha(a))for(var b=a.length,c=0;c<b;c++){var d=a[c];d instanceof U||v("Diagram.selectCollection given something that is not a Part: "+d);d.isSelected=!0}else for(a=a.iterator;a.next();)b=a.value,b instanceof U||v("Diagram.selectCollection given something that is not a Part: "+b),b.isSelected=!0;this.V("ChangedSelection",this.selection)};
Q.prototype.clearHighlighteds=function(){var a=this.highlighteds;if(0<a.count){for(var b=a.Fa(),c=b.length,d=0;d<c;d++)b[d].isHighlighted=!1;a.ka();a.clear();a.freeze()}};t=Q.prototype;t.zA=function(a){null!==a&&a.diagram===this&&(w(a,U,Q,"highlight:part"),!a.isHighlighted||1<this.highlighteds.count)&&(this.clearHighlighteds(),a.isHighlighted=!0)};
t.AA=function(a){a=(new I).addAll(a);for(var b=this.highlighteds.copy().Cq(a).iterator;b.next();)b.value.isHighlighted=!1;for(a=a.iterator;a.next();)b=a.value,b instanceof U||v("Diagram.highlightCollection given something that is not a Part: "+b),b.isHighlighted=!0};
t.scroll=function(a,b,c){void 0===c&&(c=1);var d="up"===b||"down"===b,e=0;if("pixel"===a)e=c;else if("line"===a)e=c*(d?this.scrollVerticalLineChange:this.scrollHorizontalLineChange);else if("page"===a)a=d?this.viewportBounds.height:this.viewportBounds.width,a*=this.scale,0!==a&&(e=c*Math.max(a-(d?this.scrollVerticalLineChange:this.scrollHorizontalLineChange),0));else{if("document"===a){e=this.documentBounds;c=this.viewportBounds;d=K.alloc();"up"===b?this.position=d.h(c.x,e.y):"left"===b?this.position=
d.h(e.x,c.y):"down"===b?this.position=d.h(c.x,e.bottom-c.height):"right"===b&&(this.position=d.h(e.right-c.width,c.y));K.free(d);return}v("scrolling unit must be 'pixel', 'line', 'page', or 'document', not: "+a)}e/=this.scale;c=this.position.copy();"up"===b?c.y=this.position.y-e:"down"===b?c.y=this.position.y+e:"left"===b?c.x=this.position.x-e:"right"===b?c.x=this.position.x+e:v("scrolling direction must be 'up', 'down', 'left', or 'right', not: "+b);this.position=c};
t.Tv=function(a){var b=this.viewportBounds;b.Te(a)||(a=a.center,a.x-=b.width/2,a.y-=b.height/2,this.position=a)};t.xs=function(a){var b=this.viewportBounds;a=a.center;a.x-=b.width/2;a.y-=b.height/2;this.position=a};t.Jq=function(a){var b=this.Ab;b.reset();1!==this.ya&&b.scale(this.ya);var c=this.pa;(0!==c.x||0!==c.y)&&isFinite(c.x)&&isFinite(c.y)&&b.translate(-c.x,-c.y);return a.copy().transform(this.Ab)};
t.oB=function(a){var b=this.Ab,c=a.x,d=a.y,e=c+a.width,f=d+a.height,g=b.m11,h=b.m12,k=b.m21,l=b.m22,m=b.dx,n=b.dy,p=c*g+d*k+m;b=c*h+d*l+n;var r=e*g+d*k+m;a=e*h+d*l+n;d=c*g+f*k+m;c=c*h+f*l+n;g=e*g+f*k+m;e=e*h+f*l+n;f=Math.min(p,r);p=Math.max(p,r);r=Math.min(b,a);b=Math.max(b,a);f=Math.min(f,d);p=Math.max(p,d);r=Math.min(r,c);b=Math.max(b,c);f=Math.min(f,g);p=Math.max(p,g);r=Math.min(r,e);b=Math.max(b,e);return new M(f,r,p-f,b-r)};
t.jt=function(a){var b=this.Ab;b.reset();1!==this.ya&&b.scale(this.ya);var c=this.pa;(0!==c.x||0!==c.y)&&isFinite(c.x)&&isFinite(c.y)&&b.translate(-c.x,-c.y);return Kb(a.copy(),this.Ab)};function bk(a){var b=a.isModified;a.Fx!==b&&(a.Fx=b,a.V("Modified"))}function ck(a){a=ui.get(a);return null!==a?new a:new vi}
Q.prototype.doModelChanged=function(a){var b=this;if(a.model===this.model){var c=a.change,d=a.propertyName;if(c===te&&"S"===d[0])if("StartingFirstTransaction"===d){var e=this;a=this.toolManager;a.mouseDownTools.each(function(a){a.diagram=e});a.mouseMoveTools.each(function(a){a.diagram=e});a.mouseUpTools.each(function(a){a.diagram=e});this.cd||this.fg||(this.bl=!0,this.Mn&&(this.vg=!0))}else"StartingUndo"===d||"StartingRedo"===d?(a=this.animationManager,a.defaultAnimation.isAnimating&&!this.skipsUndoManager&&
a.wc(),this.V("ChangingSelection",this.selection)):"StartedTransaction"===d&&(a=this.animationManager,a.defaultAnimation.isAnimating&&!this.skipsUndoManager&&a.wc());else if(this.ba){this.ba=!1;try{if(""===a.modelChange&&c===te){if("FinishedUndo"===d||"FinishedRedo"===d)this.V("ChangedSelection",this.selection),uh(this);var f=this.animationManager;"RolledBackTransaction"===d&&f.wc();this.bl=!0;this.od();0!==this.undoManager.transactionLevel&&1!==this.undoManager.transactionLevel||vh(f);"CommittedTransaction"===
d&&this.undoManager.isJustDiscarded&&(this.Ce=Math.min(this.Ce,this.undoManager.historyIndex-1));"CommittedTransaction"!==d&&"RolledBackTransaction"!==d||!this.undoManager.isPendingUnmodified||setTimeout(function(){b.isModified=!1},1);var g=a.isTransactionFinished;g&&(bk(this),this.Ts.clear(),Th(this.animationManager));if(!this.eu&&g&&this.lastInput.targetDiagram){this.eu=!0;var h=this;va(function(){h.currentTool.standardMouseOver();h.eu=!1},10)}}}finally{this.ba=!0}}}};
function Jj(a,b){b=b.W.m;for(var c=b.length,d=0;d<c;d++)dk(a,b[d])}function dk(a,b){if(b instanceof ek){var c=b.element;if(null!==c&&c instanceof HTMLImageElement){c.Tg instanceof I&&c.Tg.add(a);var d=b.Xg;null!==d&&!0===d.zr&&null!==b.diagram&&b.diagram.ap.add(b);if(c.Rn)if(c=c.getAttribute("src")||"",d=a.ph.K(c),null===d)d=[],d.push(b),a.ph.add(c,d);else{for(a=0;a<d.length;a++)if(d[a]===b)return;d.push(b)}}}}
function fk(a,b){if(b instanceof ek){var c=b.element;if(null!==c&&c instanceof HTMLImageElement&&(c.Tg instanceof I&&c.Tg.remove(a),gk(c),c.Rn)){c=c.getAttribute("src")||"";var d=a.ph.K(c);if(null!==d)for(var e=0;e<d.length;e++)if(d[e]===b){d.splice(e,1);0===d.length&&(a.ph.remove(c),Ki(c));break}}}}Q.prototype.Rd=function(){this.partManager.Rd()};Q.prototype.Wj=function(a,b){this.Vd.Wj(a,b)};Q.prototype.Yj=function(a,b){this.Vd.Yj(a,b)};Q.prototype.findPartForKey=function(a){return this.partManager.findPartForKey(a)};
Q.prototype.Jb=function(a){return this.partManager.Jb(a)};Q.prototype.findLinkForKey=function(a){return this.partManager.findLinkForKey(a)};t=Q.prototype;t.Gc=function(a){return this.partManager.Gc(a)};t.Ri=function(a){return this.partManager.Ri(a)};t.Fc=function(a){return this.partManager.Fc(a)};t.Ds=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];return this.partManager.Ds.apply(this.partManager,b instanceof Array?b:da(ca(b)))};
t.Cs=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];return this.partManager.Cs.apply(this.partManager,b instanceof Array?b:da(ca(b)))};function Li(a){var b=a.pa,c=a.ya;a.Ex.h(b.x,b.y,Math.max(a.Ba,0)/c,Math.max(a.Aa,0)/c)}function Ej(a,b){a.vj=!1;var c=a.gr;c.B(b)||(c=c.copy(),a.gr.assign(b),aj(a,!1),a.V("DocumentBoundsChanged",void 0,c),dj(a))}t.Ya=function(){if(this.vj){var a=M.alloc();Ej(this,this.computeBounds(a));M.free(a)}};
t.iA=function(){for(var a=new I,b=this.nodes;b.next();){var c=b.value;c.isTopLevel&&a.add(c)}for(b=this.links;b.next();)c=b.value,c.isTopLevel&&a.add(c);return a.iterator};t.hA=function(){return this.Hi.iterator};t.JA=function(a){uh(this);a&&hk(this,!0);this.cd?sj(this,!1):(this.bl=!0,Hf(this))};function hk(a,b){for(var c=a.Hi.iterator;c.next();)ik(a,c.value,b);a.layout&&(b?a.layout.isValidLayout=!1:a.layout.C())}
function ik(a,b,c){if(null!==b){for(var d=b.Cl.iterator;d.next();)ik(a,d.value,c);null!==b.layout&&(c?b.layout.isValidLayout=!1:b.layout.C())}}
function sj(a,b){if(a.Zh&&!a.Kt){var c=a.ba;a.ba=!0;var d=a.undoManager.transactionLevel,e=a.layout,f=a.animationManager;try{0===d&&(a.undoManager.isInternalTransaction=!0,a.Ea("Layout"));1>=d&&!f.defaultAnimation.isAnimating&&!f.yb&&(b||th(f,"Layout"));a.Zh=!1;for(var g=a.Hi.iterator;g.next();)jk(a,g.value,b,d);e.isValidLayout||(!b||e.isRealtime||null===e.isRealtime||0===d?(e.doLayout(a),uh(a),e.isValidLayout=!0):a.Zh=!0)}finally{b=a.undoManager.isInternalTransaction,0===d&&(a.cb("Layout"),a.undoManager.isInternalTransaction=
!1),!b||0!==d&&1!==d||vh(f),a.ba=c}}}function jk(a,b,c,d){if(null!==b){for(var e=b.Cl.iterator;e.next();)jk(a,e.value,c,d);e=b.layout;null===e||e.isValidLayout||(!c||e.isRealtime||0===d?(b.Uh=!b.location.s(),e.doLayout(b),b.C(32),uj(a,b),e.isValidLayout=!0):a.Zh=!0)}}t.oA=function(){for(var a=new H,b=this.nodes;b.next();){var c=b.value;c.isTopLevel&&null===c.Ti()&&a.add(c)}return a.iterator};
function Di(a){function b(a){var b=a.toLowerCase(),e=new H;c.add(a,e);c.add(b,e);d.add(a,a);d.add(b,a)}var c=new yb,d=new yb;b("InitialAnimationStarting");b("AnimationStarting");b("AnimationFinished");b("BackgroundSingleClicked");b("BackgroundDoubleClicked");b("BackgroundContextClicked");b("ClipboardChanged");b("ClipboardPasted");b("DocumentBoundsChanged");b("ExternalObjectsDropped");b("GainedFocus");b("InitialLayoutCompleted");b("LayoutCompleted");b("LinkDrawn");b("LinkRelinked");b("LinkReshaped");
b("LostFocus");b("Modified");b("ObjectSingleClicked");b("ObjectDoubleClicked");b("ObjectContextClicked");b("PartCreated");b("PartResized");b("PartRotated");b("SelectionMoved");b("SelectionCopied");b("SelectionDeleting");b("SelectionDeleted");b("SelectionGrouped");b("SelectionUngrouped");b("ChangingSelection");b("ChangedSelection");b("SubGraphCollapsed");b("SubGraphExpanded");b("TextEdited");b("TreeCollapsed");b("TreeExpanded");b("ViewportBoundsChanged");b("InvalidateDraw");a.Vw=c;a.Uw=d}
function Dj(a,b){var c=a.Uw.K(b);return null!==c?c:a.Uw.K(b.toLowerCase())}function kk(a,b){var c=a.Vw.K(b);if(null!==c)return c;c=a.Vw.K(b.toLowerCase());if(null!==c)return c;v("Unknown DiagramEvent name: "+b)}t.Xj=function(a,b){A(a,"string",Q,"addDiagramListener:name");A(b,"function",Q,"addDiagramListener:listener");a=kk(this,a);null!==a&&a.add(b);return this};t.ym=function(a,b){A(a,"string",Q,"removeDiagramListener:name");A(b,"function",Q,"addDiagramListener:listener");a=kk(this,a);null!==a&&a.remove(b)};
t.V=function(a,b,c){G&&A(a,"string",Q,"raiseDiagramEvent:name");var d=kk(this,a),e=new qe;e.diagram=this;a=Dj(this,a);null!==a&&(e.name=a);void 0!==b&&(e.subject=b);void 0!==c&&(e.parameter=c);b=d.length;if(1===b)d.M(0)(e);else if(0!==b)for(d=d.Fa(),c=0;c<b;c++)(0,d[c])(e)};function lk(a){if(a.animationManager.isTicking)return!1;var b=a.currentTool;return b===a.toolManager.findTool("Dragging")?!a.ms||b.isComplexRoutingRealtime:!0}
t.pk=function(a,b){return mk(this,!1,null,b||null).pk(a.x,a.y,a.width,a.height)};Q.prototype.computeOccupiedArea=function(a){return this.isVirtualized?this.viewportBounds.copy():this.vj?$i(this,a):a.assign(this.documentBounds)};
function mk(a,b,c,d){null===a.fd&&(a.fd=new nk);if(a.fd.Ms||a.fd.group!==c||a.fd.Oy!==d){null!==c&&(c=vk(a,c));if(null===c){b=M.alloc();a.computeOccupiedArea(b);b.Qc(100,100);a.fd.initialize(b);for(var e=a.nodes;e.next();){var f=e.value,g=f.layer;null!==g&&g.visible&&!g.isTemporary&&zk(a,f,d,b)}M.free(b)}else{0<c.memberParts.count&&(b=a.computePartsBounds(c.memberParts,!1),b.Qc(20,20),a.fd.initialize(b));b=M.alloc();for(e=c.memberParts;e.next();)f=e.value,f instanceof V&&zk(a,f,d,b);M.free(b)}a.fd.group=
c;a.fd.Oy=d;a.fd.Ms=!1}else b&&Ak(a.fd);return a.fd}function vk(a,b){return b.avoidable&&!b.isLinkLabel?b:null!==b.containingGroup?vk(a,b.containingGroup):null}
function zk(a,b,c,d){if(b!==c&&b.isVisible())if(b.avoidable&&!b.isLinkLabel){b=b.getAvoidableRect(d);a=a.fd;var e=b.x,f=b.y;if(Bk(a,e,f))for(c=(f-a.Gd)/a.nc|0,d=Math.min((e+b.width-a.Fd)/a.mc|0,a.Ji),b=Math.min((f+b.height-a.Gd)/a.nc|0,a.Ki),e=(e-a.Fd)/a.mc|0;e<=d;e++)if(f=a.Yb[e],f.fill)f.fill(Ck,c,b+1);else for(var g=c;g<=b;g++)f[g]=Ck}else if(b instanceof yf)for(b=b.memberParts;b.next();)e=b.value,e instanceof V&&zk(a,e,c,d)}
function Dk(a,b){null===a.fd||a.fd.Ms||void 0!==b&&(!b.avoidable||b.isLinkLabel)||(a.fd.Ms=!0)}Q.prototype.zs=function(a){this.Qq.assign(a);this.computeAutoScrollPosition(this.Qq).Za(this.position)?this.Fg():Ek(this)};
function Ek(a){-1===a.Lk&&(a.Lk=va(function(){if(-1!==a.Lk&&(a.Fg(),null!==a.lastInput.event)){var b=a.computeAutoScrollPosition(a.Qq);b.Za(a.position)||(a.position=b,a.lastInput.documentPoint=a.jt(a.Qq),a.doMouseMove(),a.vj=!0,b=M.alloc(),a.computeBounds(b),b.Xc(a.documentBounds),Ej(a,b),M.free(b),a.bd=!0,a.od(),Ek(a))}},a.Pq))}Q.prototype.Fg=function(){-1!==this.Lk&&(sa.clearTimeout(this.Lk),this.Lk=-1)};
Q.prototype.computeAutoScrollPosition=function(a){var b=this.position,c=this.Rq;if(0>=c.top&&0>=c.left&&0>=c.right&&0>=c.bottom)return b;var d=this.viewportBounds,e=this.scale;d=M.allocAt(0,0,d.width*e,d.height*e);var f=K.allocAt(0,0);if(a.x>=d.x&&a.x<d.x+c.left&&this.allowHorizontalScroll){var g=Math.max(this.scrollHorizontalLineChange,1);g|=0;f.x-=g;a.x<d.x+c.left/2&&(f.x-=g);a.x<d.x+c.left/4&&(f.x-=4*g)}else a.x<=d.x+d.width&&a.x>d.x+d.width-c.right&&this.allowHorizontalScroll&&(g=Math.max(this.scrollHorizontalLineChange,
1),g|=0,f.x+=g,a.x>d.x+d.width-c.right/2&&(f.x+=g),a.x>d.x+d.width-c.right/4&&(f.x+=4*g));a.y>=d.y&&a.y<d.y+c.top&&this.allowVerticalScroll?(g=Math.max(this.scrollVerticalLineChange,1),g|=0,f.y-=g,a.y<d.y+c.top/2&&(f.y-=g),a.y<d.y+c.top/4&&(f.y-=4*g)):a.y<=d.y+d.height&&a.y>d.y+d.height-c.bottom&&this.allowVerticalScroll&&(g=Math.max(this.scrollVerticalLineChange,1),g|=0,f.y+=g,a.y>d.y+d.height-c.bottom/2&&(f.y+=g),a.y>d.y+d.height-c.bottom/4&&(f.y+=4*g));f.Za(zb)||(b=new K(b.x+f.x/e,b.y+f.y/e));
M.free(d);K.free(f);return b};t=Q.prototype;t.Vs=function(){return null};t.yv=function(){return null};t.sz=function(a,b){this.fz.add(a,b)};t.Mu=function(a){(this.Bx=a)||this.nodes.each(function(a){a instanceof yf&&(a.mr=null)})};
function Fk(a,b,c){function d(){var a=+new Date;f=!0;for(g.reset();g.next();)if(!g.value[0].xl){f=!1;break}f||a-l>k?b(c,e,h):sa.requestAnimationFrame(d)}for(var e=c.callback,f=!0,g=a.ph.iterator;g.next();)if(!g.value[0].xl){f=!1;break}if("function"!==typeof e||f)return b(c,e,a);var h=a,k=c.callbackTimeout||300,l=+new Date;sa.requestAnimationFrame(function(){d()});return null}t.LA=function(a){if(!Wg)return null;void 0===a&&(a={});a.returnType="Image";return this.xy(a)};
t.xy=function(a){void 0===a&&(a={});return Fk(this,this.MA,a)};
t.MA=function(a,b,c){var d=Gk(c,a,"canvas",null);if(null===d)return null;c=d.aa.canvas;var e=null;if(null!==c)switch(e=a.returnType,void 0===e?e="string":e=e.toLowerCase(),e){case Hk+"data":e=d.getImageData(0,0,c.width,c.height);break;case Hk:d=(a.document||document).createElement("img");d.src=c.toDataURL(a.type,a.details);e=d;break;case "blob":"function"!==typeof b&&v('Error: Diagram.makeImageData called with "returnType: toBlob", but no required "callback" function property defined.');if("function"===
typeof c.toBlob)return c.toBlob(b,a.type,a.details),"toBlob";if("function"===typeof c.msToBlob)return b(c.msToBlob()),"msToBlob";b(null);return null;default:e=c.toDataURL(a.type,a.details)}return"function"===typeof b?(b(e),null):e};
function Gk(a,b,c,d){a.animationManager.wc();a.od();if(null===a.Ia)return null;"object"!==typeof b&&v("properties argument must be an Object.");var e=!1,f=b.size||null,g=b.scale||null;void 0!==b.scale&&isNaN(b.scale)&&(g="NaN");var h=b.maxSize;void 0===b.maxSize&&(e=!0,h="SVG"===c?new Hb(Infinity,Infinity):new Hb(2E3,2E3));var k=b.position||null,l=b.parts||null,m=void 0===b.padding?1:b.padding,n=b.background||null,p=b.omitTemporary;void 0===p&&(p=!0);var r=b.document||document,q=b.elementFinished||
null,u=b.showTemporary;void 0===u&&(u=!p);b=b.showGrid;void 0===b&&(b=u);null!==f&&isNaN(f.width)&&isNaN(f.height)&&(f=null);"number"===typeof m?m=new fc(m):m instanceof fc||v("MakeImage padding must be a Margin or a number.");m.left=Math.max(m.left,0);m.right=Math.max(m.right,0);m.top=Math.max(m.top,0);m.bottom=Math.max(m.bottom,0);a.$b.Oc(!0);p=new Ik(null,r);var x=p.context;if(!(f||g||l||k)){p.width=a.Ba+Math.ceil(m.left+m.right);p.height=a.Aa+Math.ceil(m.top+m.bottom);if("SVG"===c){if(null===
d)return null;d.resize(p.width,p.height,p.width,p.height);d.ownerDocument=r;d.gq=q;Bj(a,d.context,m,new Hb(p.width,p.height),a.ya,a.pa,l,n,u,b);return d.context}a.Dn=!1;Bj(a,x,m,new Hb(p.width,p.height),a.ya,a.pa,l,n,u,b);a.Dn=!0;return p.context}var y=a.er,z=a.documentBounds.copy();z.aw(a.sb);if(u)for(var B=a.Ua.m,D=B.length,C=0;C<D;C++){var J=B[C];if(J.visible&&J.isTemporary){J=J.Ma.m;for(var S=J.length,T=0;T<S;T++){var aa=J[T];aa.isInDocumentBounds&&aa.isVisible()&&(aa=aa.actualBounds,aa.s()&&
z.Xc(aa))}}}B=new K(z.x,z.y);if(null!==l){D=new M(0,0,0,0);C=!0;J=l.iterator;for(J.reset();J.next();)S=J.value,S instanceof U&&(T=S.layer,null!==T&&!T.visible||null!==T&&!u&&T.isTemporary||!S.isVisible()||(S=S.actualBounds,S.s()&&(C?(C=!1,D.assign(S)):D.Xc(S))));z.width=D.width;z.height=D.height;B.x=D.x;B.y=D.y}null!==k&&k.s()&&(B=k,g||(g=y));D=k=0;null!==m&&(k=m.left+m.right,D=m.top+m.bottom);C=J=0;null!==f&&(J=f.width,C=f.height,isFinite(J)&&(J=Math.max(0,J-k)),isFinite(C)&&(C=Math.max(0,C-D)));
null!==f&&null!==g?("NaN"===g&&(g=y),f.s()?(f=J,z=C):isNaN(C)?(f=J,z=z.height*g):(f=z.width*g,z=C)):null!==f?f.s()?(g=Math.min(J/z.width,C/z.height),f=J,z=C):isNaN(C)?(g=J/z.width,f=J,z=z.height*g):(g=C/z.height,f=z.width*g,z=C):null!==g?"NaN"===g&&h.s()?(g=Math.min((h.width-k)/z.width,(h.height-D)/z.height),g>y?(g=y,f=z.width,z=z.height):(f=h.width,z=h.height)):(f=z.width*g,z=z.height*g):(g=y,f=z.width,z=z.height);null!==m?(f+=k,z+=D):m=new fc(0);null!==h&&(y=h.width,h=h.height,"SVG"!==c&&e&&!Jk&&
G&&(f>y||z>h)&&(Fa("Diagram.makeImage(data): Diagram width or height is larger than the default max size. ("+Math.ceil(f)+"x"+Math.ceil(z)+" vs 2000x2000) Consider increasing the max size."),Jk=!0),isNaN(y)&&(y=2E3),isNaN(h)&&(h=2E3),isFinite(y)&&(f=Math.min(f,y)),isFinite(h)&&(z=Math.min(z,h)));p.width=Math.ceil(f);p.height=Math.ceil(z);if("SVG"===c){if(null===d)return null;d.resize(p.width,p.height,p.width,p.height);d.ownerDocument=r;d.gq=q;Bj(a,d.context,m,new Hb(Math.ceil(f),Math.ceil(z)),g,B,
l,n,u,b);return d.context}a.Dn=!1;Bj(a,x,m,new Hb(Math.ceil(f),Math.ceil(z)),g,B,l,n,u,b);a.Dn=!0;return p.context}
na.Object.defineProperties(Q.prototype,{div:{configurable:!0,get:function(){return this.La},set:function(a){null!==a&&w(a,HTMLDivElement,Q,"div");if(this.La!==a){var b=this.La;null!==b?(b.D=void 0,b.goDiagram=void 0,b.go=void 0,b.innerHTML="",null!==this.Ia&&(b=this.Ia.Qa,this.removeEventListener(b,"pointermove",this.wk,!1),this.removeEventListener(b,"pointerdown",this.vk,!1),this.removeEventListener(b,"pointerup",this.yk,!1),this.removeEventListener(b,"pointerout",this.xk,!1),this.Ia.Wx()),
this.Kl&&(this.Kl.disconnect(),this.Kl=null),b=this.toolManager,null!==b&&(b.mouseDownTools.each(function(a){a.cancelWaitAfter()}),b.mouseMoveTools.each(function(a){a.cancelWaitAfter()}),b.mouseUpTools.each(function(a){a.cancelWaitAfter()})),b.cancelWaitAfter(),this.currentTool.doCancel(),this.Ia=null,this.removeEventListener(sa,"resize",this.mw,!1),this.removeEventListener(sa,"wheel",this.sk,!0),Ge===this&&(Ge=null)):this.fg=!1;this.La=null;if(null!==a){if(b=a.D)b.div=null;Bi(this,a);this.redraw()}}}},
Mx:{configurable:!0,get:function(){return this.Mr}},$i:{configurable:!0,get:function(){return this.fg}},draggedLink:{configurable:!0,get:function(){return this.Eu},set:function(a){this.Eu!==a&&(this.Eu=a,null!==a&&(this.fw=a.fromPort,this.lw=a.toPort))}},By:{configurable:!0,get:function(){return this.fw},set:function(a){this.fw=a}},Cy:{configurable:!0,get:function(){return this.lw},set:function(a){this.lw=a}},animationManager:{configurable:!0,
enumerable:!0,get:function(){return this.Vd}},undoManager:{configurable:!0,get:function(){return this.ac.undoManager}},skipsUndoManager:{configurable:!0,get:function(){return this.vh},set:function(a){A(a,"boolean",Q,"skipsUndoManager");this.vh=a;this.ac.skipsUndoManager=a}},delaysLayout:{configurable:!0,get:function(){return this.Kt},set:function(a){this.Kt=a}},opacity:{configurable:!0,get:function(){return this.rb},set:function(a){var b=this.rb;
b!==a&&(A(a,"number",Q,"opacity"),(0>a||1<a)&&Ba(a,"0 <= value <= 1",Q,"opacity"),this.rb=a,this.g("opacity",b,a),this.R())}},validCycle:{configurable:!0,get:function(){return this.qt},set:function(a){var b=this.qt;b!==a&&(db(a,Q,Q,"validCycle"),this.qt=a,this.g("validCycle",b,a))}},layers:{configurable:!0,get:function(){return this.Ua.iterator}},isModelReadOnly:{configurable:!0,get:function(){var a=this.ac;return null===a?!1:a.isReadOnly},set:function(a){var b=
this.ac;null!==b&&(b.isReadOnly=a)}},isReadOnly:{configurable:!0,get:function(){return this.dh},set:function(a){var b=this.dh;b!==a&&(A(a,"boolean",Q,"isReadOnly"),this.dh=a,this.g("isReadOnly",b,a))}},isEnabled:{configurable:!0,get:function(){return this.Cd},set:function(a){var b=this.Cd;b!==a&&(A(a,"boolean",Q,"isEnabled"),this.Cd=a,this.g("isEnabled",b,a))}},allowClipboard:{configurable:!0,get:function(){return this.Dk},set:function(a){var b=this.Dk;b!==
a&&(A(a,"boolean",Q,"allowClipboard"),this.Dk=a,this.g("allowClipboard",b,a))}},allowCopy:{configurable:!0,get:function(){return this.F},set:function(a){var b=this.F;b!==a&&(A(a,"boolean",Q,"allowCopy"),this.F=a,this.g("allowCopy",b,a))}},allowDelete:{configurable:!0,get:function(){return this.O},set:function(a){var b=this.O;b!==a&&(A(a,"boolean",Q,"allowDelete"),this.O=a,this.g("allowDelete",b,a))}},allowDragOut:{configurable:!0,get:function(){return this.Ek},
set:function(a){var b=this.Ek;b!==a&&(A(a,"boolean",Q,"allowDragOut"),this.Ek=a,this.g("allowDragOut",b,a))}},allowDrop:{configurable:!0,get:function(){return this.Vm},set:function(a){var b=this.Vm;b!==a&&(A(a,"boolean",Q,"allowDrop"),this.Vm=a,this.g("allowDrop",b,a))}},allowTextEdit:{configurable:!0,get:function(){return this.Ud},set:function(a){var b=this.Ud;b!==a&&(A(a,"boolean",Q,"allowTextEdit"),this.Ud=a,this.g("allowTextEdit",b,a))}},allowGroup:{configurable:!0,
enumerable:!0,get:function(){return this.Da},set:function(a){var b=this.Da;b!==a&&(A(a,"boolean",Q,"allowGroup"),this.Da=a,this.g("allowGroup",b,a))}},allowUngroup:{configurable:!0,get:function(){return this.te},set:function(a){var b=this.te;b!==a&&(A(a,"boolean",Q,"allowUngroup"),this.te=a,this.g("allowUngroup",b,a))}},allowInsert:{configurable:!0,get:function(){return this.wt},set:function(a){var b=this.wt;b!==a&&(A(a,"boolean",Q,"allowInsert"),this.wt=a,this.g("allowInsert",
b,a))}},allowLink:{configurable:!0,get:function(){return this.Ha},set:function(a){var b=this.Ha;b!==a&&(A(a,"boolean",Q,"allowLink"),this.Ha=a,this.g("allowLink",b,a))}},allowRelink:{configurable:!0,get:function(){return this.Vb},set:function(a){var b=this.Vb;b!==a&&(A(a,"boolean",Q,"allowRelink"),this.Vb=a,this.g("allowRelink",b,a))}},allowMove:{configurable:!0,get:function(){return this.Ra},set:function(a){var b=this.Ra;b!==a&&(A(a,"boolean",Q,"allowMove"),
this.Ra=a,this.g("allowMove",b,a))}},allowReshape:{configurable:!0,get:function(){return this.Mb},set:function(a){var b=this.Mb;b!==a&&(A(a,"boolean",Q,"allowReshape"),this.Mb=a,this.g("allowReshape",b,a))}},allowResize:{configurable:!0,get:function(){return this.Wb},set:function(a){var b=this.Wb;b!==a&&(A(a,"boolean",Q,"allowResize"),this.Wb=a,this.g("allowResize",b,a))}},allowRotate:{configurable:!0,get:function(){return this.xc},set:function(a){var b=this.xc;
b!==a&&(A(a,"boolean",Q,"allowRotate"),this.xc=a,this.g("allowRotate",b,a))}},allowSelect:{configurable:!0,get:function(){return this.Td},set:function(a){var b=this.Td;b!==a&&(A(a,"boolean",Q,"allowSelect"),this.Td=a,this.g("allowSelect",b,a))}},allowUndo:{configurable:!0,get:function(){return this.xt},set:function(a){var b=this.xt;b!==a&&(A(a,"boolean",Q,"allowUndo"),this.xt=a,this.g("allowUndo",b,a))}},allowZoom:{configurable:!0,get:function(){return this.At},
set:function(a){var b=this.At;b!==a&&(A(a,"boolean",Q,"allowZoom"),this.At=a,this.g("allowZoom",b,a))}},hasVerticalScrollbar:{configurable:!0,get:function(){return this.$n},set:function(a){var b=this.$n;b!==a&&(A(a,"boolean",Q,"hasVerticalScrollbar"),this.$n=a,dj(this),this.R(),this.g("hasVerticalScrollbar",b,a),aj(this,!1))}},hasHorizontalScrollbar:{configurable:!0,get:function(){return this.Zn},set:function(a){var b=this.Zn;b!==a&&(A(a,"boolean",Q,"hasHorizontalScrollbar"),
this.Zn=a,dj(this),this.R(),this.g("hasHorizontalScrollbar",b,a),aj(this,!1))}},allowHorizontalScroll:{configurable:!0,get:function(){return this.vt},set:function(a){var b=this.vt;b!==a&&(A(a,"boolean",Q,"allowHorizontalScroll"),this.vt=a,this.g("allowHorizontalScroll",b,a),aj(this,!1))}},allowVerticalScroll:{configurable:!0,get:function(){return this.zt},set:function(a){var b=this.zt;b!==a&&(A(a,"boolean",Q,"allowVerticalScroll"),this.zt=a,this.g("allowVerticalScroll",
b,a),aj(this,!1))}},scrollHorizontalLineChange:{configurable:!0,get:function(){return this.lt},set:function(a){var b=this.lt;b!==a&&(A(a,"number",Q,"scrollHorizontalLineChange"),0>a&&Ba(a,">= 0",Q,"scrollHorizontalLineChange"),this.lt=a,this.g("scrollHorizontalLineChange",b,a))}},scrollVerticalLineChange:{configurable:!0,get:function(){return this.mt},set:function(a){var b=this.mt;b!==a&&(A(a,"number",Q,"scrollVerticalLineChange"),0>a&&Ba(a,">= 0",Q,"scrollVerticalLineChange"),
this.mt=a,this.g("scrollVerticalLineChange",b,a))}},lastInput:{configurable:!0,get:function(){return this.Dj},set:function(a){G&&w(a,oe,Q,"lastInput");this.Dj=a}},previousInput:{configurable:!0,get:function(){return this.rh},set:function(a){G&&w(a,oe,Q,"previousInput");this.rh=a}},firstInput:{configurable:!0,get:function(){return this.pr},set:function(a){G&&w(a,oe,Q,"firstInput");this.pr=a}},currentCursor:{configurable:!0,get:function(){return this.kt},
set:function(a){""===a&&(a=this.kj);if(this.kt!==a){A(a,"string",Q,"currentCursor");var b=this.Ia,c=this.La;if(null!==b&&null!==c){this.kt=a;var d=b.style.cursor;b.style.cursor=a;c.style.cursor=a;b.style.cursor===d&&(b.style.cursor="-webkit-"+a,c.style.cursor="-webkit-"+a,b.style.cursor===d&&(b.style.cursor="-moz-"+a,c.style.cursor="-moz-"+a,b.style.cursor===d&&(b.style.cursor=a,c.style.cursor=a)))}}}},defaultCursor:{configurable:!0,get:function(){return this.kj},set:function(a){""===
a&&(a="auto");var b=this.kj;b!==a&&(A(a,"string",Q,"defaultCursor"),this.kj=a,this.g("defaultCursor",b,a))}},click:{configurable:!0,get:function(){return this.Mg},set:function(a){var b=this.Mg;b!==a&&(null!==a&&A(a,"function",Q,"click"),this.Mg=a,this.g("click",b,a))}},doubleClick:{configurable:!0,get:function(){return this.Ug},set:function(a){var b=this.Ug;b!==a&&(null!==a&&A(a,"function",Q,"doubleClick"),this.Ug=a,this.g("doubleClick",b,a))}},contextClick:{configurable:!0,
enumerable:!0,get:function(){return this.Og},set:function(a){var b=this.Og;b!==a&&(null!==a&&A(a,"function",Q,"contextClick"),this.Og=a,this.g("contextClick",b,a))}},mouseOver:{configurable:!0,get:function(){return this.nh},set:function(a){var b=this.nh;b!==a&&(null!==a&&A(a,"function",Q,"mouseOver"),this.nh=a,this.g("mouseOver",b,a))}},mouseHover:{configurable:!0,get:function(){return this.lh},set:function(a){var b=this.lh;b!==a&&(null!==a&&A(a,"function",Q,"mouseHover"),
this.lh=a,this.g("mouseHover",b,a))}},mouseHold:{configurable:!0,get:function(){return this.kh},set:function(a){var b=this.kh;b!==a&&(null!==a&&A(a,"function",Q,"mouseHold"),this.kh=a,this.g("mouseHold",b,a))}},mouseDragOver:{configurable:!0,get:function(){return this.Jv},set:function(a){var b=this.Jv;b!==a&&(null!==a&&A(a,"function",Q,"mouseDragOver"),this.Jv=a,this.g("mouseDragOver",b,a))}},mouseDrop:{configurable:!0,get:function(){return this.ih},set:function(a){var b=
this.ih;b!==a&&(G&&null!==a&&A(a,"function",Q,"mouseDrop"),this.ih=a,this.g("mouseDrop",b,a))}},handlesDragDropForTopLevelParts:{configurable:!0,get:function(){return this.gv},set:function(a){var b=this.gv;b!==a&&(A(a,"boolean",Q,"handlesDragDropForTopLevelParts"),this.gv=a,this.g("handlesDragDropForTopLevelParts",b,a))}},mouseEnter:{configurable:!0,get:function(){return this.jh},set:function(a){var b=this.jh;b!==a&&(null!==a&&A(a,"function",Q,"mouseEnter"),this.jh=a,this.g("mouseEnter",
b,a))}},mouseLeave:{configurable:!0,get:function(){return this.mh},set:function(a){var b=this.mh;b!==a&&(null!==a&&A(a,"function",Q,"mouseLeave"),this.mh=a,this.g("mouseLeave",b,a))}},toolTip:{configurable:!0,get:function(){return this.Fh},set:function(a){var b=this.Fh;b!==a&&(!G||null===a||a instanceof Ke||a instanceof Pe||v("Diagram.toolTip must be an Adornment or HTMLInfo."),this.Fh=a,this.g("toolTip",b,a))}},contextMenu:{configurable:!0,get:function(){return this.Pg},
set:function(a){var b=this.Pg;b!==a&&(!G||a instanceof Ke||a instanceof Pe||v("Diagram.contextMenu must be an Adornment or HTMLInfo."),this.Pg=a,this.g("contextMenu",b,a))}},commandHandler:{configurable:!0,get:function(){return this.uw},set:function(a){this.uw!==a&&(this.uw=a,a.$e(this))}},toolManager:{configurable:!0,get:function(){return this.Ew},set:function(a){this.Ew!==a&&(w(a,Va,Q,"toolManager"),this.Ew=a,a.diagram=this)}},defaultTool:{configurable:!0,
get:function(){return this.ww},set:function(a){var b=this.ww;b!==a&&(w(a,ze,Q,"defaultTool"),this.ww=a,a.diagram=this,this.currentTool===b&&(this.currentTool=a))}},currentTool:{configurable:!0,get:function(){return this.vw},set:function(a){var b=this.vw;b&&(b.isActive&&b.doDeactivate(),b.cancelWaitAfter(),b.doStop());null===a&&(a=this.defaultTool);null!==a&&(w(a,ze,Q,"currentTool"),this.vw=a,a.diagram=this,a.doStart())}},selection:{configurable:!0,get:function(){return this.ux}},
maxSelectionCount:{configurable:!0,get:function(){return this.Fv},set:function(a){var b=this.Fv;if(b!==a)if(A(a,"number",Q,"maxSelectionCount"),0<=a&&!isNaN(a)){if(this.Fv=a,this.g("maxSelectionCount",b,a),!this.undoManager.isUndoingRedoing&&(a=this.selection.count-a,0<a)){this.V("ChangingSelection",this.selection);b=this.selection.Fa();for(var c=0;c<a;c++)b[c].isSelected=!1;this.V("ChangedSelection",this.selection)}}else Ba(a,">= 0",Q,"maxSelectionCount")}},nodeSelectionAdornmentTemplate:{configurable:!0,
enumerable:!0,get:function(){return this.Rv},set:function(a){var b=this.Rv;b!==a&&(w(a,Ke,Q,"nodeSelectionAdornmentTemplate"),this.Rv=a,this.g("nodeSelectionAdornmentTemplate",b,a))}},groupSelectionAdornmentTemplate:{configurable:!0,get:function(){return this.Zu},set:function(a){var b=this.Zu;b!==a&&(w(a,Ke,Q,"groupSelectionAdornmentTemplate"),this.Zu=a,this.g("groupSelectionAdornmentTemplate",b,a))}},linkSelectionAdornmentTemplate:{configurable:!0,get:function(){return this.Av},
set:function(a){var b=this.Av;b!==a&&(w(a,Ke,Q,"linkSelectionAdornmentTemplate"),this.Av=a,this.g("linkSelectionAdornmentTemplate",b,a))}},highlighteds:{configurable:!0,get:function(){return this.ax}},isModified:{configurable:!0,get:function(){var a=this.undoManager;return a.isEnabled?null!==a.currentTransaction?!0:this.ho&&this.Ce!==a.historyIndex:this.ho},set:function(a){if(this.ho!==a){A(a,"boolean",Q,"isModified");this.ho=a;var b=this.undoManager;!a&&b.isEnabled&&(this.Ce=
b.historyIndex);a||bk(this)}}},model:{configurable:!0,get:function(){return this.ac},set:function(a){var b=this.ac;if(b!==a){w(a,Y,Q,"model");this.currentTool.doCancel();b&&b.undoManager!==a.undoManager&&b.undoManager.isInTransaction&&v("Do not replace a Diagram.model while a transaction is in progress.");this.animationManager.wc(!0);var c=Ji(this,!0);this.fg=!1;this.Mn=!0;this.Ce=-2;this.vg=!1;var d=this.vb;this.vb=!0;th(this.animationManager,"Model");b&&(null!==this.rf&&this.rf.each(function(a){b.Ak(a)}),
b.Ak(this.Bw));this.ac=a;this.partManager=ck(this.ac.type);for(var e=0;e<c.length;e++)this.add(c[e]);a.Jh(this.Aw);this.partManager.addAllModeledParts();a.Ak(this.Aw);a.Jh(this.Bw);null!==this.rf&&this.rf.each(function(b){a.Jh(b)});this.vb=d;this.Wa();this.vb||this.R();b&&a.undoManager.copyProperties(b.undoManager)}}},ba:{configurable:!0,get:function(){return this.zw},set:function(a){this.zw=a}},Ts:{configurable:!0,get:function(){return this.Wy}},skipsModelSourceBindings:{configurable:!0,
enumerable:!0,get:function(){return this.Dw},set:function(a){this.Dw=a}},ht:{configurable:!0,get:function(){return this.uu},set:function(a){this.uu=a}},nodeTemplate:{configurable:!0,get:function(){return this.j.K("")},set:function(a){var b=this.j.K("");b!==a&&(w(a,U,Q,"nodeTemplate"),this.j.add("",a),this.g("nodeTemplate",b,a),this.undoManager.isUndoingRedoing||this.Rd())}},nodeTemplateMap:{configurable:!0,get:function(){return this.j},set:function(a){var b=
this.j;b!==a&&(w(a,yb,Q,"nodeTemplateMap"),this.j=a,this.g("nodeTemplateMap",b,a),this.undoManager.isUndoingRedoing||this.Rd())}},groupTemplate:{configurable:!0,get:function(){return this.Ic.K("")},set:function(a){var b=this.Ic.K("");b!==a&&(w(a,yf,Q,"groupTemplate"),this.Ic.add("",a),this.g("groupTemplate",b,a),this.undoManager.isUndoingRedoing||this.Rd())}},groupTemplateMap:{configurable:!0,get:function(){return this.Ic},set:function(a){var b=this.Ic;b!==a&&(w(a,yb,Q,
"groupTemplateMap"),this.Ic=a,this.g("groupTemplateMap",b,a),this.undoManager.isUndoingRedoing||this.Rd())}},linkTemplate:{configurable:!0,get:function(){return this.o.K("")},set:function(a){var b=this.o.K("");b!==a&&(w(a,R,Q,"linkTemplate"),this.o.add("",a),this.g("linkTemplate",b,a),this.undoManager.isUndoingRedoing||this.Rd())}},linkTemplateMap:{configurable:!0,get:function(){return this.o},set:function(a){var b=this.o;b!==a&&(w(a,yb,Q,"linkTemplateMap"),this.o=a,this.g("linkTemplateMap",
b,a),this.undoManager.isUndoingRedoing||this.Rd())}},isMouseCaptured:{configurable:!0,get:function(){return this.yw},set:function(a){var b=this.Ia;null!==b&&(b=b.Qa,b instanceof SVGElement||(a?(this.lastInput.bubbles=!1,this.removeEventListener(b,"pointermove",this.wk,!1),this.removeEventListener(b,"pointerdown",this.vk,!1),this.removeEventListener(b,"pointerup",this.yk,!1),this.removeEventListener(b,"pointerout",this.xk,!1),this.addEventListener(sa,"pointermove",this.wk,!0),this.addEventListener(sa,
"pointerdown",this.vk,!0),this.addEventListener(sa,"pointerup",this.yk,!0),this.addEventListener(sa,"pointerout",this.xk,!0),this.removeEventListener(b,"wheel",this.sk,!1),this.addEventListener(sa,"wheel",this.sk,!0),this.addEventListener(sa,"selectstart",this.preventDefault,!1)):(this.removeEventListener(sa,"pointermove",this.wk,!0),this.removeEventListener(sa,"pointerdown",this.vk,!0),this.removeEventListener(sa,"pointerup",this.yk,!0),this.removeEventListener(sa,"pointerout",this.xk,!0),this.addEventListener(b,
"pointermove",this.wk,!1),this.addEventListener(b,"pointerdown",this.vk,!1),this.addEventListener(b,"pointerup",this.yk,!1),this.addEventListener(b,"pointerout",this.xk,!1),this.removeEventListener(sa,"wheel",this.sk,!0),this.removeEventListener(sa,"selectstart",this.preventDefault,!1),this.addEventListener(b,"wheel",this.sk,!1)),this.yw=a))}},position:{configurable:!0,get:function(){return this.pa},set:function(a){var b=K.alloc().assign(this.pa);if(!b.B(a)){w(a,K,Q,"position");var c=
this.viewportBounds.copy();this.pa.assign(a);Wh(this.animationManager,b,this.pa);this.vb||null===this.Ia&&!this.Sp.s()?Li(this):(this.vb=!0,a=this.scale,cj(this,this.gr,this.Ba/a,this.Aa/a,this.Sk,!1),this.vb=!1);if(!this.vb)this.onViewportBoundsChanged(c,this.viewportBounds,this.ya,!1)}K.free(b)}},initialPosition:{configurable:!0,get:function(){return this.nv},set:function(a){this.nv.B(a)||(w(a,K,Q,"initialPosition"),this.nv=a.L())}},initialScale:{configurable:!0,get:function(){return this.tv},
set:function(a){this.tv!==a&&(A(a,"number",Q,"initialScale"),this.tv=a)}},grid:{configurable:!0,get:function(){null===this.de&&(this.de=Vi(this));return this.de},set:function(a){var b=this.de;if(b!==a){null===b&&(b=this.de=Vi(this));w(a,X,Q,"grid");a.type!==X.Grid&&v("Diagram.grid must be a Panel of type Panel.Grid");var c=b.panel;null!==c&&c.remove(b);this.de=a;a.name="GRID";null!==c&&c.add(a);rj(this);this.R();this.g("grid",b,a)}}},viewportBounds:{configurable:!0,get:function(){return this.Ex}},
viewSize:{configurable:!0,get:function(){return this.Sp},set:function(a){var b=this.viewSize;b.B(a)||(w(a,Hb,Q,"viewSize"),this.Sp=a=a.L(),this.Aa=this.Ba=0,a.s()?(this.Ba=a.width,this.Aa=a.height):null!==this.La&&(this.Ba=this.La.clientWidth||1,this.Aa=this.La.clientHeight||1),Li(this),this.Wa(),this.g("viewSize",b,a),this.redraw())}},fixedBounds:{configurable:!0,get:function(){return this.Su},set:function(a){var b=this.Su;b.B(a)||(w(a,M,Q,"fixedBounds"),(G&&Infinity===
a.width||-Infinity===a.width||Infinity===a.height||-Infinity===a.height)&&v("fixedBounds width/height must not be Infinity"),this.Su=a=a.L(),this.Wa(),this.g("fixedBounds",b,a))}},scrollMargin:{configurable:!0,get:function(){return this.Rj},set:function(a){"number"===typeof a?a=new fc(a):w(a,fc,Q,"scrollMargin");var b=this.Rj;b.B(a)||(this.Rj=a=a.L(),this.g("scrollMargin",b,a),this.Bq())}},scrollMode:{configurable:!0,get:function(){return this.Sj},set:function(a){var b=
this.Sj;b!==a&&(db(a,Q,Q,"scrollMode"),this.Sj=a,a===$h&&aj(this,!1),this.g("scrollMode",b,a),this.R())}},scrollsPageOnFocus:{configurable:!0,get:function(){return this.nt},set:function(a){var b=this.nt;b!==a&&(A(a,"boolean",Q,"scrollsPageOnFocus"),this.nt=a,this.g("scrollsPageOnFocus",b,a))}},positionComputation:{configurable:!0,get:function(){return this.qw},set:function(a){var b=this.qw;b!==a&&(null!==a&&A(a,"function",Q,"positionComputation"),this.qw=a,aj(this,!1),
this.g("positionComputation",b,a))}},scaleComputation:{configurable:!0,get:function(){return this.rw},set:function(a){var b=this.rw;b!==a&&(null!==a&&A(a,"function",Q,"scaleComputation"),this.rw=a,Zj(this,this.scale,this.scale),this.g("scaleComputation",b,a))}},documentBounds:{configurable:!0,get:function(){return this.gr}},isVirtualized:{configurable:!0,get:function(){return this.wv},set:function(a){var b=this.wv;b!==a&&(A(a,"boolean",Q,"isVirtualized"),
this.wv=a,this.g("isVirtualized",b,a))}},scale:{configurable:!0,get:function(){return this.ya},set:function(a){var b=this.ya;E(a,Q,"scale");b!==a&&Zj(this,b,a)}},defaultScale:{configurable:!0,get:function(){return this.er},set:function(a){G&&E(a,Q,"defaultScale");!G||0<a||v("defaultScale must be larger than zero, not: "+a);this.er=a}},autoScale:{configurable:!0,get:function(){return this.$h},set:function(a){var b=this.$h;b!==a&&(db(a,Q,Q,"autoScale"),this.$h=
a,this.g("autoScale",b,a),a!==zh&&aj(this,!1))}},initialAutoScale:{configurable:!0,get:function(){return this.bh},set:function(a){var b=this.bh;b!==a&&(db(a,Q,Q,"initialAutoScale"),this.bh=a,this.g("initialAutoScale",b,a))}},initialViewportSpot:{configurable:!0,get:function(){return this.uv},set:function(a){var b=this.uv;b!==a&&(w(a,Ib,Q,"initialViewportSpot"),a.fb()||v("initialViewportSpot must be a specific Spot: "+a),this.uv=a,this.g("initialViewportSpot",b,a))}},initialDocumentSpot:{configurable:!0,
enumerable:!0,get:function(){return this.lv},set:function(a){var b=this.lv;b!==a&&(w(a,Ib,Q,"initialDocumentSpot"),a.fb()||v("initialViewportSpot must be a specific Spot: "+a),this.lv=a,this.g("initialDocumentSpot",b,a))}},minScale:{configurable:!0,get:function(){return this.Gv},set:function(a){E(a,Q,"minScale");var b=this.Gv;b!==a&&(0<a?(this.Gv=a,this.g("minScale",b,a),a>this.scale&&(this.scale=a)):Ba(a,"> 0",Q,"minScale"))}},maxScale:{configurable:!0,get:function(){return this.Cv},
set:function(a){E(a,Q,"maxScale");var b=this.Cv;b!==a&&(0<a?(this.Cv=a,this.g("maxScale",b,a),a<this.scale&&(this.scale=a)):Ba(a,"> 0",Q,"maxScale"))}},zoomPoint:{configurable:!0,get:function(){return this.rt},set:function(a){this.rt.B(a)||(w(a,K,Q,"zoomPoint"),this.rt=a=a.L())}},contentAlignment:{configurable:!0,get:function(){return this.Sk},set:function(a){var b=this.Sk;b.B(a)||(w(a,Ib,Q,"contentAlignment"),this.Sk=a=a.L(),this.g("contentAlignment",b,a),aj(this,!1))}},
initialContentAlignment:{configurable:!0,get:function(){return this.vr},set:function(a){var b=this.vr;b.B(a)||(w(a,Ib,Q,"initialContentAlignment"),this.vr=a=a.L(),this.g("initialContentAlignment",b,a))}},padding:{configurable:!0,get:function(){return this.sb},set:function(a){"number"===typeof a?a=new fc(a):w(a,fc,Q,"padding");var b=this.sb;b.B(a)||(this.sb=a=a.L(),this.Wa(),this.g("padding",b,a))}},partManager:{configurable:!0,get:function(){return this.Cw},
set:function(a){var b=this.Cw;b!==a&&(w(a,vi,Q,"partManager"),null!==a.diagram&&v("Cannot share PartManagers between Diagrams: "+a.toString()),b&&b.$e(null),this.Cw=a,a.$e(this))}},nodes:{configurable:!0,get:function(){return this.partManager.nodes.iterator}},links:{configurable:!0,get:function(){return this.partManager.links.iterator}},parts:{configurable:!0,get:function(){return this.partManager.parts.iterator}},layout:{configurable:!0,get:function(){return this.Kc},
set:function(a){var b=this.Kc;b!==a&&(w(a,zi,Q,"layout"),this.Kc=a,a.diagram=this,a.group=null,this.Zh=!0,this.g("layout",b,a),this.Lb())}},isTreePathToChildren:{configurable:!0,get:function(){return this.vv},set:function(a){var b=this.vv;if(b!==a&&(A(a,"boolean",Q,"isTreePathToChildren"),this.vv=a,this.g("isTreePathToChildren",b,a),!this.undoManager.isUndoingRedoing))for(a=this.nodes;a.next();)Kk(a.value)}},treeCollapsePolicy:{configurable:!0,get:function(){return this.ot},
set:function(a){var b=this.ot;b!==a&&(a!==Ei&&a!==Lk&&a!==Mk&&v("Unknown Diagram.treeCollapsePolicy: "+a),this.ot=a,this.g("treeCollapsePolicy",b,a))}},Xe:{configurable:!0,get:function(){return this.xw},set:function(a){this.xw=a}},autoScrollInterval:{configurable:!0,get:function(){return this.Pq},set:function(a){var b=this.Pq;E(a,Q,"scale");b!==a&&(this.Pq=a,this.g("autoScrollInterval",b,a))}},autoScrollRegion:{configurable:!0,get:function(){return this.Rq},
set:function(a){"number"===typeof a?a=new fc(a):w(a,fc,Q,"autoScrollRegion");var b=this.Rq;b.B(a)||(this.Rq=a=a.L(),this.Wa(),this.g("autoScrollRegion",b,a))}}});na.Object.defineProperties(Q,{licenseKey:{configurable:!0,get:function(){return Nk.fc()},set:function(a){Nk.add(a.replace(/\s/g,""))}},version:{configurable:!0,get:function(){return Ok}}});Q.prototype.makeImageData=Q.prototype.xy;Q.prototype.makeImage=Q.prototype.LA;Q.prototype.cacheGroupExternalLinks=Q.prototype.Mu;
Q.prototype.addRenderer=Q.prototype.sz;Q.prototype.makeSVG=Q.prototype.yv;Q.prototype.makeSvg=Q.prototype.Vs;Q.prototype.stopAutoScroll=Q.prototype.Fg;Q.prototype.doAutoScroll=Q.prototype.zs;Q.prototype.isUnoccupied=Q.prototype.pk;Q.prototype.raiseDiagramEvent=Q.prototype.V;Q.prototype.removeDiagramListener=Q.prototype.ym;Q.prototype.addDiagramListener=Q.prototype.Xj;Q.prototype.findTreeRoots=Q.prototype.oA;Q.prototype.layoutDiagram=Q.prototype.JA;Q.prototype.findTopLevelGroups=Q.prototype.hA;
Q.prototype.findTopLevelNodesAndLinks=Q.prototype.iA;Q.prototype.ensureBounds=Q.prototype.Ya;Q.prototype.findLinksByExample=Q.prototype.Cs;Q.prototype.findNodesByExample=Q.prototype.Ds;Q.prototype.findLinkForData=Q.prototype.Fc;Q.prototype.findNodeForData=Q.prototype.Ri;Q.prototype.findPartForData=Q.prototype.Gc;Q.prototype.findLinkForKey=Q.prototype.findLinkForKey;Q.prototype.findNodeForKey=Q.prototype.Jb;Q.prototype.findPartForKey=Q.prototype.findPartForKey;Q.prototype.rebuildParts=Q.prototype.Rd;
Q.prototype.transformViewToDoc=Q.prototype.jt;Q.prototype.transformRectDocToView=Q.prototype.oB;Q.prototype.transformDocToView=Q.prototype.Jq;Q.prototype.centerRect=Q.prototype.xs;Q.prototype.scrollToRect=Q.prototype.Tv;Q.prototype.scroll=Q.prototype.scroll;Q.prototype.highlightCollection=Q.prototype.AA;Q.prototype.highlight=Q.prototype.zA;Q.prototype.selectCollection=Q.prototype.fB;Q.prototype.select=Q.prototype.select;Q.prototype.updateAllRelationshipsFromData=Q.prototype.Mq;
Q.prototype.updateAllTargetBindings=Q.prototype.updateAllTargetBindings;Q.prototype.commit=Q.prototype.commit;Q.prototype.rollbackTransaction=Q.prototype.Tf;Q.prototype.commitTransaction=Q.prototype.cb;Q.prototype.startTransaction=Q.prototype.Ea;Q.prototype.raiseChanged=Q.prototype.g;Q.prototype.raiseChangedEvent=Q.prototype.bb;Q.prototype.removeChangedListener=Q.prototype.Ak;Q.prototype.addChangedListener=Q.prototype.Jh;Q.prototype.removeModelChangedListener=Q.prototype.aB;
Q.prototype.addModelChangedListener=Q.prototype.Kx;Q.prototype.findLayer=Q.prototype.ik;Q.prototype.removeLayer=Q.prototype.ZA;Q.prototype.addLayerAfter=Q.prototype.oz;Q.prototype.addLayerBefore=Q.prototype.Ix;Q.prototype.addLayer=Q.prototype.em;Q.prototype.moveParts=Q.prototype.moveParts;Q.prototype.copyParts=Q.prototype.ek;Q.prototype.removeParts=Q.prototype.bt;Q.prototype.remove=Q.prototype.remove;Q.prototype.add=Q.prototype.add;Q.prototype.clearDelayedGeometries=Q.prototype.Nu;
Q.prototype.setProperties=Q.prototype.Lm;Q.prototype.attach=Q.prototype.Ju;Q.prototype.set=Q.prototype.set;Q.prototype.resetInputOptions=Q.prototype.Hy;Q.prototype.setInputOption=Q.prototype.gB;Q.prototype.getInputOption=Q.prototype.om;Q.prototype.resetRenderingHints=Q.prototype.Iy;Q.prototype.setRenderingHint=Q.prototype.My;Q.prototype.getRenderingHint=Q.prototype.Ve;Q.prototype.maybeUpdate=Q.prototype.od;Q.prototype.requestUpdate=Q.prototype.Lb;Q.prototype.delayInitialization=Q.prototype.Lz;
Q.prototype.isUpdateRequested=Q.prototype.FA;Q.prototype.invalidateDocumentBounds=Q.prototype.Wa;Q.prototype.findObjectsNear=Q.prototype.Bg;Q.prototype.findPartsNear=Q.prototype.dA;Q.prototype.findObjectsIn=Q.prototype.Lf;Q.prototype.findPartsIn=Q.prototype.gy;Q.prototype.findObjectsAt=Q.prototype.Si;Q.prototype.findPartsAt=Q.prototype.cA;Q.prototype.findObjectAt=Q.prototype.dc;Q.prototype.findPartAt=Q.prototype.mm;Q.prototype.focusObject=Q.prototype.pA;Q.prototype.alignDocument=Q.prototype.vz;
Q.prototype.zoomToRect=Q.prototype.sB;Q.prototype.zoomToFit=Q.prototype.zoomToFit;Q.prototype.diagramScroll=Q.prototype.Ux;Q.prototype.focus=Q.prototype.focus;
var ui=new yb,Mi=null,Wg=void 0!==sa.document,Hi=null,Ii="",zh=new F(Q,"None",0),fj=new F(Q,"Uniform",1),gj=new F(Q,"UniformToFill",2),Mf=new F(Q,"CycleAll",10),Tf=new F(Q,"CycleNotDirected",11),Vf=new F(Q,"CycleNotDirectedFast",12),Wf=new F(Q,"CycleNotUndirected",13),Nf=new F(Q,"CycleDestinationTree",14),Pf=new F(Q,"CycleSourceTree",15),$h=new F(Q,"DocumentScroll",1),bi=new F(Q,"InfiniteScroll",2),Ei=new F(Q,"TreeParentCollapsed",21),Lk=new F(Q,"AllParentsCollapsed",22),Mk=new F(Q,"AnyParentsCollapsed",
23),Nk=new H,Ok="2.2.7",Hk="image",Jk=!1,Pk=null,si=!1;
function ti(){if(Wg){var a=sa.document.createElement("canvas"),b=a.getContext("2d"),c=Wa("7ca11abfd022028846");b[c]=Wa("398c3597c01238");for(var d=["5da73c80a36455d6038e4972187c3cae51fd22",ta.Dx+"4ae6247590da4bb21c324ba3a84e385776",Jb.xF+"fb236cdfda5de14c134ba1a95a2d4c7cc6f93c1387",L.za],e=1;5>e;e++)b[Wa("7ca11abfd7330390")](Wa(d[e-1]),10,15*e);b[c]=Wa("39f046ebb36e4b");for(c=1;5>c;c++)b[Wa("7ca11abfd7330390")](Wa(d[c-1]),10,15*c);if(4!==d.length||"5"!==d[0][0]||"7"!==d[3][0])Jb.prototype.Od=Jb.prototype.Nx;
Pk=a}}Q.className="Diagram";Q.fromDiv=function(a){var b=a;"string"===typeof a&&(b=sa.document.getElementById(a));return b instanceof HTMLDivElement&&b.D instanceof Q?b.D:null};Q.inherit=function(a,b){function c(){}if(Object.getPrototypeOf(a).prototype)throw Error("Used go.Diagram.inherit defining already defined class \n"+a);A(a,"function",Q,"inherit");A(b,"function",Q,"inherit");c.prototype=b.prototype;a.prototype=new c;a.prototype.constructor=a};Q.useDOM=function(a){Wg=a?void 0!==sa.document:!1};
Q.isUsingDOM=function(){return Wg};Q.None=zh;Q.Uniform=fj;Q.UniformToFill=gj;Q.CycleAll=Mf;Q.CycleNotDirected=Tf;Q.CycleNotDirectedFast=Vf;Q.CycleNotUndirected=Wf;Q.CycleDestinationTree=Nf;Q.CycleSourceTree=Pf;Q.DocumentScroll=$h;Q.InfiniteScroll=bi;Q.TreeParentCollapsed=Ei;Q.AllParentsCollapsed=Lk;Q.AnyParentsCollapsed=Mk;function Ai(){this.jz=null;this.j="zz@orderNum";"63ad05bbe23a1786468a4c741b6d2"===this._tk?this.rd=this.j=!0:this.rd=null}
function Aj(a,b){b.$b.setTransform(b.jc,0,0,b.jc,0,0);b.$b.Ld();if(null===a.rd)a:{b="f";var c=sa[Wa("76a715b2f73f148a")][Wa("72ba13b5")];a.rd=!0;if(Wg){var d=Q[Wa("76a115b6ed251eaf4692")];if(d)for(var e=Nk.iterator;e.next();){d=e.value;d=Wa(d).split(Wa("39e9"));if(6>d.length)break;var f=Wa(d[1]).split(".");if("7da71ca0"!==d[4])break;var g=Wa(ta[Wa("6cae19")]).split(".");if(f[0]>g[0]||f[0]===g[0]&&f[1]>=g[1]){var h=sa[Wa("74a900bae4370f8b51")][Wa("6fbb13a1c2311e8a57")].toLowerCase();g=h[Wa("73a612b6fb191d")](Wa("3aad1ab6e022098b4dc4"));
f=Wa(d[2]);if(-1<g&&(h=h[Wa("73a612b6fb191d")](f.toLowerCase()+"/"),a.rd=!(-1<h&&h<g),!a.rd))break;g=c[Wa("76ad18b4f73e")];for(h=c[Wa("73a612b6fb191d")](Wa("35e7"))+2;h<g;h++)b+=c[h];g=b[Wa("73a612b6fb191d")](f);0>g&&f!==Wa("7da71ca0ad381e90")&&(g=b[Wa("73a612b6fb191d")](Wa("76a715b2ef3e149757")));0>g&&(g=b[Wa("73a612b6fb191d")](Wa("76a715b2ef3e149757")));0>g&&(g=c[Wa("73a612b6fb191d")](Wa("7baa19a6f76c1988428554")));a.rd=!(0<=g&&g<b[Wa("73a612b6fb191d")](Wa("35"))||-1===b[Wa("73a612b6fb191d")](Wa("35")));
if(!a.rd)break;if(c[Wa("73a612b6fb191d")](Wa("7fb002b6ed25128b4da25b2e"))&&c[Wa("73a612b6fb191d")](Wa("75ba1beee63a1e875799507d"))&&(a.rd=!(-1<c[Wa("73a612b6fb191d")](f)),!a.rd))break;if("#"===f[0]){g=sa.document.createElement("div");for(var k=d[0].replace(/[A-Za-z]/g,"");4>k.length;)k+="9";h=k;k=k.substr(k.length-4);d="";d+=["gsh","gsf"][parseInt(k.substr(0,1),10)%2];d+=["Header","Background","Display","Feedback"][parseInt(k.substr(0,1),10)%4];g[Wa("79a417a0f0181a8946")]=d;if(sa.document[Wa("78a712aa")]){sa.document[Wa("78a712aa")][Wa("7bb806b6ed32388c4a875b")](g);
k=sa.getComputedStyle(g).getPropertyValue(Wa("78a704b7e62456904c9b12701b6532a8"));var l=sa.getComputedStyle(g).getPropertyValue(Wa("75b817b0ea2202"));sa.document[Wa("78a712aa")][Wa("68ad1bbcf533388c4a875b")](g);if(k)if(g=sa[Wa("77a902b0eb1b1e804a8a")],l==="0."+parseInt(h,10)%100||-1!==k.indexOf(parseInt(f[1]+f[2],16))&&-1!==k.indexOf(parseInt(f[3]+f[4],16))){a.rd=!1;break}else if(g&&g(Wa("32ae19a1e0331fc94084537c067a67fa59f1386b89d006")).matches)for(d="."+d,f=0;f<document.styleSheets.length;f++){g=
document.styleSheets[f].rules||document.styleSheets[f].cssRules;for(var m in g)if(d===g[m].selectorText){a.rd=!1;break a}}}else a.rd=null,a.rd=!1}}}else{m=c[Wa("76ad18b4f73e")];for(e=c[Wa("73a612b6fb191d")](Wa("35e7"))+2;e<m;e++)b+=c[e];c=b[Wa("73a612b6fb191d")](Wa("7da71ca0ad381e90"));a.rd=!(0<=c&&c<b[Wa("73a612b6fb191d")](Wa("35")))}}}return 0<a.rd&&a!==a.jz?!0:!1}
function Bi(a,b){if(Wg){void 0!==b&&null!==b||v("Diagram setup requires an argument DIV.");null!==a.La&&v("Diagram has already completed setup.");"string"===typeof b?a.La=sa.document.getElementById(b):b instanceof HTMLDivElement?a.La=b:v("No DIV or DIV id supplied: "+b);null===a.La&&v("Invalid DIV id; could not get element with id: "+b);void 0!==a.La.D&&v("Invalid div id; div already has a Diagram associated with it.");if(!a.Kl&&sa.ResizeObserver){var c=ua(function(){a.Lb()},250);a.Kl=new sa.ResizeObserver(function(){c()});
a.Kl.observe(a.La)}"static"===sa.getComputedStyle(a.La,null).position&&(a.La.style.position="relative");b=5;var d="rgba(2"+b+"5, 255, 255, 0)";b--;a.La.style["-webkit-tap-highlight-color"]=d;a.La.innerHTML="";a.La.D=a;a.La.goDiagram=a;a.La.go=sa.go;var e=a.ns?new Fj(a):new Ik(a);void 0!==e.style&&(e.style.position="absolute",e.style.top="0px",e.style.left="0px","rtl"===sa.getComputedStyle(a.La,null).getPropertyValue("direction")&&(a.jo=!0),e.style.zIndex="2",e.style.userSelect="none",e.style.MozUserSelect=
"none",e.style.touchAction="none");a.Ia=e;a.$b=e.context;d=a.$b;a.jc=a.computePixelRatio();a.viewSize.s()||(a.Ba=a.La.clientWidth||1,a.Aa=a.La.clientHeight||1);Hj(a,a.Ba,a.Aa);a.La.insertBefore(e.Qa,a.La.firstChild);e=new Ik(null);e.width=1;e.height=1;a.Ww=e;a.cz=e.context;if(Wg){e=wa("div");var f=wa("div");e.style.position="absolute";e.style.overflow="auto";e.style.width=a.Ba+"px";e.style.height=a.Aa+"px";e.style.zIndex="1";f.style.position="absolute";f.style.width="1px";f.style.height="1px";a.La.appendChild(e);
e.appendChild(f);e.onscroll=Wi;e.addEventListener("pointerdown",Yi);e.D=a;e.hz=!0;e.iz=!0;a.su=e;a.qu=f}a.Bq=ua(function(){a.Di=null;a.R()},300);a.mw=ua(function(){Ah(a)},250);a.preventDefault=function(a){a.preventDefault();return!1};a.sk=function(b){if(a.isEnabled){var c=kj(a,b,!0);c.bubbles=!0;var d=0,e=0;c.delta=0;void 0!==b.deltaX?(0!==b.deltaX&&(d=0<b.deltaX?1:-1),0!==b.deltaY&&(e=0<b.deltaY?1:-1),c.delta=Math.abs(b.deltaX)>Math.abs(b.deltaY)?-d:-e):void 0!==b.wheelDeltaX?(0!==b.wheelDeltaX&&
(d=0<b.wheelDeltaX?-1:1),0!==b.wheelDeltaY&&(e=0<b.wheelDeltaY?-1:1),c.delta=Math.abs(b.wheelDeltaX)>Math.abs(b.wheelDeltaY)?-d:-e):void 0!==b.wheelDelta&&0!==b.wheelDelta&&(c.delta=0<b.wheelDelta?1:-1);a.doMouseWheel();oj(a,c,b)}};a.QA=function(b){a.isEnabled&&(a.pl=!1,kj(a,b,!0),b=a.currentTool,b.cancelWaitAfter(),b.standardMouseOver())};a.vk=function(b){if(a.isEnabled){a.pl=!0;var c=a.iu;void 0===c[b.pointerId]&&(c[b.pointerId]=b);c=a.Hl;var d=!1;if(null!==c[0]&&c[0].pointerId===b.pointerId)c[0]=
b;else if(null!==c[1]&&c[1].pointerId===b.pointerId)c[1]=b,d=!0;else if(null===c[0])c[0]=b;else if(null===c[1])c[1]=b,d=!0;else{b.preventDefault();return}if(c="touch"===b.pointerType||"pen"===b.pointerType)a.wu=!1,a.Zt=!0;var e=d;d=nj(a,b,!0,!1,!0,e);lj(a,b,d);d.targetDiagram=mj(b,b.target);d.targetObject=null;e||d.clone(a.pr);e=a.hx;c=c?25:10;b.timeStamp-a.gx<a.mz&&!(Math.abs(e.x-b.screenX)>c||Math.abs(e.y-b.screenY)>c)?a.Er++:a.Er=1;d.clickCount=a.Er;a.gx=b.timeStamp;a.hx.Eg(b.screenX,b.screenY);
a.doMouseDown();1===b.button?b.preventDefault():oj(a,d,b)}};a.wk=function(b){if(a.isEnabled){a.pl=!0;var c=a.Hl;if(null!==c[0]&&c[0].pointerId===b.pointerId)c[0]=b;else{if(null!==c[1]&&c[1].pointerId===b.pointerId){c[1]=b;return}if(null===c[0])c[0]=b;else return}if(c[0].pointerId===b.pointerId){c=nj(a,b,!1,!1,!1,null!==c[1]);var d=sa.document.elementFromPoint(b.clientX,b.clientY);null!==d&&void 0!==d.shadowRoot&&null!==d.shadowRoot&&(d=d.shadowRoot.elementFromPoint(b.clientX,b.clientY));var e=a,f=
b;d&&d.D&&(f=b,e=d.D);c.targetDiagram=e;lj(a,f,c);c.targetObject=null;a.doMouseMove();oj(a,c,b)}}};a.yk=function(b){if(a.isEnabled){a.pl=!0;var c="touch"===b.pointerType||"pen"===b.pointerType,d=a.iu;if(c&&a.wu)delete d[b.pointerId],b.preventDefault();else if(d=a.Hl,null!==d[0]&&d[0].pointerId===b.pointerId){d[0]=null;d=nj(a,b,!1,!0,!0,!1);var e=sa.document.elementFromPoint(b.clientX,b.clientY);null!==e&&void 0!==e.shadowRoot&&null!==e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(b.clientX,b.clientY));
null!==e&&e.D instanceof Q&&e.D!==a&&lj(e.D,b,d);null===e&&(e=b.target);lj(a,b,d);d.clickCount=a.Er;d.targetDiagram=mj(b,e);d.targetObject=null;a.doMouseUp();oj(a,d,b);c&&(a.Zt=!1)}else null!==d[1]&&d[1].pointerId===b.pointerId&&(d[1]=null)}};a.xk=function(b){if(a.isEnabled){a.pl=!1;var c=a.iu;c[b.pointerId]&&delete c[b.pointerId];c=a.Hl;null!==c[0]&&c[0].pointerId===b.pointerId&&(c[0]=null);null!==c[1]&&c[1].pointerId===b.pointerId&&(c[1]=null);"touch"!==b.pointerType&&"pen"!==b.pointerType&&(b=
a.currentTool,b.cancelWaitAfter(),b.standardMouseOver())}};a.Mt=d.aa["d"+Qk[1]+Qk[2]+"wI"+Hk.slice(1,5)]["b"+Rk.slice(1,b)](d.aa,Pk,b,b);d.Oc(!0);Ni(a)}}Ai.className="DiagramHelper";function df(a){this.j=void 0===a?new K:a;this.o=new K}na.Object.defineProperties(df.prototype,{point:{configurable:!0,get:function(){return this.j},set:function(a){this.j=a}},shifted:{configurable:!0,get:function(){return this.o},set:function(a){this.o=a}}});var Qk="DraggingInfo";
df.className="DraggingInfo";function Sj(a,b,c){this.node=a;this.info=b;this.kv=c}Sj.className="DraggingNodeInfoPair";function Se(){this.reset()}Se.prototype.reset=function(){this.isGridSnapEnabled=!1;this.isGridSnapRealtime=!0;this.gridSnapCellSize=(new Hb(NaN,NaN)).freeze();this.gridSnapCellSpot=Cc;this.gridSnapOrigin=(new K(NaN,NaN)).freeze();this.groupsSnapMembers=this.dragsTree=this.dragsLink=!1;this.dragsMembers=this.groupsAlwaysMove=!0};Se.className="DraggingOptions";
function Sk(a,b){if("string"===typeof a||sa.Element&&a instanceof Element)var c=Q.call(this,a)||this;else c=Q.call(this)||this,b=a;Tk(c);b&&c.Lm(b);return c}ma(Sk,Q);function Tk(a){a.allowDragOut=!0;a.allowMove=!1;a.isReadOnly=!0;a.contentAlignment=Dc;a.layout=new Uk}Sk.prototype.reset=function(){Q.prototype.reset.call(this);Tk(this)};Sk.className="Palette";
function Vk(a,b){if("string"===typeof a||sa.Element&&a instanceof Element)var c=Q.call(this,a)||this;else c=Q.call(this)||this,b=a;var d=c;c.animationManager.isEnabled=!1;c.vb=!0;c.bw=null;c.Zn=!1;c.$n=!1;c.Lu=!0;c.Ku=!0;c.pt=0;c.lj=!1;c.Rl=null;c.My("drawShadows",!1);a=new U;var e=new Kf;e.stroke="magenta";e.strokeWidth=2;e.fill="transparent";e.name="BOXSHAPE";a.selectable=!0;a.selectionAdorned=!1;a.selectionObjectName="BOXSHAPE";a.locationObjectName="BOXSHAPE";a.resizeObjectName="BOXSHAPE";a.cursor=
"move";a.add(e);c.jj=a;c.allowCopy=!1;c.allowDelete=!1;c.allowSelect=!0;c.autoScrollRegion=new fc(0,0,0,0);c.pa.h(0,0);c.toolManager.gb("Dragging",new Wk,c.toolManager.mouseMoveTools);c.click=function(){var a=d.observed;if(null!==a){var b=a.viewportBounds,c=d.lastInput.documentPoint;a.position=new K(c.x-b.width/2,c.y-b.height/2)}};c.Iw=function(){d.Wa();Xk(d)};c.Hw=function(){null!==d.observed&&(d.Wa(),d.R())};c.st=function(){1>d.updateDelay?d.R():d.lj||(d.lj=!0,setTimeout(function(){return d.redraw()},
d.updateDelay))};c.Gw=function(){null!==d.observed&&Xk(d)};c.autoScale=fj;c.vb=!1;b&&Object.assign(c,b);return c}ma(Vk,Q);Vk.prototype.computePixelRatio=function(){return 1};
Vk.prototype.redraw=function(){if(this.lj&&1<=this.updateDelay){this.lj=!1;var a=this.Ia,b=this.$b;if(null!==a&&null!==b){yj(this);if(null===this.Rl){var c=new Ik(null);c.width=a.width;c.height=a.height;this.Rl=c}try{this.Ia=this.Rl,this.$b=this.Ia.context,this.$b.Oc(!0),this.$b.setTransform(1,0,0,1,0,0),this.$b.clearRect(0,0,this.Ia.width,this.Ia.height),Yk(this)}finally{this.Ia=a,this.$b=b}}}Q.prototype.redraw.call(this)};
Vk.prototype.uc=function(){null===this.La&&v("No div specified");null===this.Ia&&v("No canvas specified");if(!(this.Ia instanceof Fj)&&(ni(this.box),this.bd)){var a=this.observed;if(null!==a&&!a.animationManager.defaultAnimation.isAnimating&&a.$i){yj(this);var b=this.Ia;a=this.$b;a.Oc(!0);a.setTransform(1,0,0,1,0,0);a.clearRect(0,0,b.width,b.height);1>this.updateDelay?Yk(this):null!==this.Rl&&(a.drawImage(this.Rl.Qa,0,0),b=this.Ab,b.reset(),1!==this.scale&&b.scale(this.scale),0===this.position.x&&
0===this.position.y||b.translate(-this.position.x,-this.position.y),a.scale(this.jc,this.jc),a.transform(b.m11,b.m12,b.m21,b.m22,b.dx,b.dy));b=this.Ua.m;for(var c=b.length,d=0;d<c;d++)b[d].uc(a,this);this.bd=this.xj=!1}}};
function Yk(a){var b=a.observed;if(null!==b){var c=a.drawsTemporaryLayers,d=a.drawsGrid&&c,e=b.grid;d&&null!==e&&e.visible&&!isNaN(e.width)&&!isNaN(e.height)&&(e=M.alloc().assign(a.viewportBounds).Xc(b.viewportBounds),rj(b,e),M.free(e),uh(b));var f=a.Ab;f.reset();1!==a.scale&&f.scale(a.scale);0===a.position.x&&0===a.position.y||f.translate(-a.position.x,-a.position.y);e=a.$b;e.scale(a.jc,a.jc);e.transform(f.m11,f.m12,f.m21,f.m22,f.dx,f.dy);b=b.Ua.m;f=b.length;for(var g=0;g<f;g++){var h=b[g],k=a;if(h.visible&&
0!==h.opacity){var l=h.diagram.grid.part;if(!c&&h.isTemporary)d&&l.layer===h&&(h=oi(h,e),l.uc(e,k),e.globalAlpha=h);else{for(var m=oi(h,e),n=k.scale,p=M.alloc(),r=h.Ma.m,q=r.length,u=0;u<q;u++){var x=r[u];(d||x!==l)&&h.Oi(e,x,k,null,n,p,!1)}M.free(p);e.globalAlpha=m}}}}}
function Xk(a){var b=a.box;if(null!==b){var c=a.observed;if(null!==c){a.bd=!0;c=c.viewportBounds;var d=b.selectionObject,e=Hb.alloc();e.h(c.width,c.height);d.desiredSize=e;Hb.free(e);a=2/a.scale;d instanceof Kf&&(d.strokeWidth=a);b.location=new K(c.x-a/2,c.y-a/2);b.isSelected=!0}}}Vk.prototype.computeBounds=function(){var a=this.observed;if(null===a)return pc;var b=a.documentBounds.copy();b.Xc(a.viewportBounds);return b};Vk.prototype.invalidateViewport=function(){!0!==this.bd&&(this.bd=!0,this.Lb())};
Vk.prototype.onViewportBoundsChanged=function(a,b,c,d){this.vb||(Zi(this),this.R(),dj(this),this.Wa(),Xk(this),this.ld.scale=c,this.ld.position.x=a.x,this.ld.position.y=a.y,this.ld.bounds.assign(a),this.ld.vy=d,this.V("ViewportBoundsChanged",this.ld,a))};
na.Object.defineProperties(Vk.prototype,{observed:{configurable:!0,get:function(){return this.bw},set:function(a){var b=this.bw;null!==a&&w(a,Q,Vk,"observed");a instanceof Vk&&v("Overview.observed Diagram may not be an Overview itself: "+a);if(b!==a){null!==b&&(this.remove(this.box),b.ym("ViewportBoundsChanged",this.Iw),b.ym("DocumentBoundsChanged",this.Hw),b.ym("InvalidateDraw",this.st),b.ym("AnimationFinished",this.Gw));this.bw=a;null!==a&&(a.Xj("ViewportBoundsChanged",this.Iw),a.Xj("DocumentBoundsChanged",
this.Hw),a.Xj("InvalidateDraw",this.st),a.Xj("AnimationFinished",this.Gw),this.add(this.box));this.Wa();if(null===a){this.Rl=null;var c=this.Ia,d=this.$b;c&&d&&(d.setTransform(1,0,0,1,0,0),d.clearRect(0,0,c.width,c.height))}else this.st(null),Xk(this),this.R();this.g("observed",b,a)}}},box:{configurable:!0,get:function(){return this.jj},set:function(a){var b=this.jj;b!==a&&(this.jj=a,this.remove(b),this.add(this.jj),Xk(this),this.g("box",b,a))}},drawsTemporaryLayers:{configurable:!0,
enumerable:!0,get:function(){return this.Lu},set:function(a){this.Lu!==a&&(this.Lu=a,this.redraw())}},drawsGrid:{configurable:!0,get:function(){return this.Ku},set:function(a){this.Ku!==a&&(this.Ku=a,this.redraw())}},updateDelay:{configurable:!0,get:function(){return this.pt},set:function(a){0>a&&(a=0);this.pt!==a&&(this.pt=a)}}});Vk.className="Overview";function Wk(){Re.call(this);this.j=null}ma(Wk,Re);
Wk.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(null===a||!a.allowMove||!a.allowSelect)return!1;var b=a.observed;if(null===b)return!1;var c=a.lastInput;if(!c.left||a.currentTool!==this&&(!this.isBeyondDragSize()||c.isTouchEvent&&c.timestamp-a.firstInput.timestamp<this.delay))return!1;null===this.findDraggablePart()&&(c=b.viewportBounds,this.j=new K(c.width/2,c.height/2),a=a.firstInput.documentPoint,b.position=new K(a.x-this.j.x,a.y-this.j.y));return!0};
Wk.prototype.doActivate=function(){this.j=null;Re.prototype.doActivate.call(this)};Wk.prototype.doUpdateCursor=function(){var a=this.diagram,b=a.box;null!==b&&b.cursor&&(a.currentCursor=b.cursor)};Wk.prototype.moveParts=function(){var a=this.diagram,b=a.observed;if(null!==b){var c=a.box;if(null!==c){if(null===this.j){var d=a.firstInput.documentPoint;c=c.location;this.j=new K(d.x-c.x,d.y-c.y)}a=a.lastInput.documentPoint;b.position=new K(a.x-this.j.x,a.y-this.j.y)}}};Wk.className="OverviewDraggingTool";
function Zk(){0<arguments.length&&Ca(Zk);ab(this);this.D=Ge;this.Ra=this.F=this.o=!0;this.O=this.Da=this.Vb=this.Ha=!1;this.wi=this.j=null;this.xc=1.05;this.$t=NaN;this.ex=null;this.Du=NaN;this.Cu=pc;this.Mb=!0;this.pg=null;this.Wb=200}Zk.prototype.toString=function(){return"CommandHandler"};Zk.prototype.$e=function(a){this.D=a};
Zk.prototype.doKeyDown=function(){var a=this.diagram,b=a.lastInput,c=$a?b.meta:b.control,d=b.shift,e=b.alt,f=b.key;!c||"C"!==f&&"Insert"!==f?c&&"X"===f||d&&"Del"===f?this.canCutSelection()&&this.cutSelection():c&&"V"===f||d&&"Insert"===f?this.canPasteSelection()&&this.pasteSelection():c&&"Y"===f||e&&d&&"Backspace"===f?this.canRedo()&&this.redo():c&&"Z"===f||e&&"Backspace"===f?this.canUndo()&&this.undo():"Del"===f||"Backspace"===f?this.canDeleteSelection()&&this.deleteSelection():c&&"A"===f?this.canSelectAll()&&
this.selectAll():"Esc"===f?this.canStopCommand()&&this.stopCommand():"Up"===f?a.allowVerticalScroll&&(c?a.scroll("pixel","up"):a.scroll("line","up")):"Down"===f?a.allowVerticalScroll&&(c?a.scroll("pixel","down"):a.scroll("line","down")):"Left"===f?a.allowHorizontalScroll&&(c?a.scroll("pixel","left"):a.scroll("line","left")):"Right"===f?a.allowHorizontalScroll&&(c?a.scroll("pixel","right"):a.scroll("line","right")):"PageUp"===f?d&&a.allowHorizontalScroll?a.scroll("page","left"):a.allowVerticalScroll&&
a.scroll("page","up"):"PageDown"===f?d&&a.allowHorizontalScroll?a.scroll("page","right"):a.allowVerticalScroll&&a.scroll("page","down"):"Home"===f?c&&a.allowVerticalScroll?a.scroll("document","up"):!c&&a.allowHorizontalScroll&&a.scroll("document","left"):"End"===f?c&&a.allowVerticalScroll?a.scroll("document","down"):!c&&a.allowHorizontalScroll&&a.scroll("document","right"):" "===f?this.canScrollToPart()&&this.scrollToPart():"Subtract"===f?this.canDecreaseZoom()&&this.decreaseZoom():"Add"===f?this.canIncreaseZoom()&&
this.increaseZoom():c&&"0"===f?this.canResetZoom()&&this.resetZoom():d&&"Z"===f?this.canZoomToFit()&&this.zoomToFit():c&&!d&&"G"===f?this.canGroupSelection()&&this.groupSelection():c&&d&&"G"===f?this.canUngroupSelection()&&this.ungroupSelection():"F2"===f||b.event&&"F2"===b.event.key?this.canEditTextBlock()&&this.editTextBlock():"ContextMenu"===f||b.event&&"ContextMenu"===b.event.key?this.canShowContextMenu()&&this.showContextMenu():b.bubbles=!0:this.canCopySelection()&&this.copySelection()};
Zk.prototype.doKeyUp=function(){this.diagram.lastInput.bubbles=!0};Zk.prototype.stopCommand=function(){var a=this.diagram,b=a.currentTool;b instanceof Va&&a.allowSelect&&a.clearSelection();null!==b&&b.doCancel()};Zk.prototype.canStopCommand=function(){return!0};
Zk.prototype.selectAll=function(){var a=this.diagram;a.R();try{a.currentCursor="wait";a.V("ChangingSelection",a.selection);for(var b=a.parts;b.next();)b.value.isSelected=!0;for(var c=a.nodes;c.next();)c.value.isSelected=!0;for(var d=a.links;d.next();)d.value.isSelected=!0}finally{a.V("ChangedSelection",a.selection),a.currentCursor=""}};Zk.prototype.canSelectAll=function(){return this.diagram.allowSelect};
Zk.prototype.deleteSelection=function(){var a=this.diagram;try{a.currentCursor="wait";a.V("ChangingSelection",a.selection);a.Ea("Delete");a.V("SelectionDeleting",a.selection);for(var b=new I,c=a.selection.iterator;c.next();)$k(b,c.value,!0,this.deletesTree?Infinity:0,this.deletesConnectedLinks?null:!1,function(a){return a.canDelete()});a.bt(b,!0);a.V("SelectionDeleted",b)}finally{a.cb("Delete"),a.V("ChangedSelection",a.selection),a.currentCursor=""}};
Zk.prototype.canDeleteSelection=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly||!a.allowDelete||0===a.selection.count?!1:!0};Zk.prototype.copySelection=function(){var a=this.diagram,b=new I;for(a=a.selection.iterator;a.next();)$k(b,a.value,!0,this.copiesTree?Infinity:0,this.copiesConnectedLinks,function(a){return a.canCopy()});this.copyToClipboard(b)};Zk.prototype.canCopySelection=function(){var a=this.diagram;return a.allowCopy&&a.allowClipboard&&0!==a.selection.count?!0:!1};
Zk.prototype.cutSelection=function(){this.copySelection();this.deleteSelection()};Zk.prototype.canCutSelection=function(){var a=this.diagram;return!a.isReadOnly&&!a.isModelReadOnly&&a.allowCopy&&a.allowDelete&&a.allowClipboard&&0!==a.selection.count?!0:!1};
Zk.prototype.copyToClipboard=function(a){var b=this.diagram,c=null;if(null===a)Hi=null,Ii="";else{c=b.model;var d=!1,e=!1,f=null;try{c.rm()&&(d=c.dk,c.dk=this.copiesParentKey),c.nk()&&(e=c.ck,c.ck=this.copiesGroupKey),f=b.ek(a,null,!0)}finally{c.rm()&&(c.dk=d),c.nk()&&(c.ck=e),c=new H,c.addAll(f),Hi=c,Ii=b.model.dataFormat}}b.V("ClipboardChanged",c)};
Zk.prototype.pasteFromClipboard=function(){var a=new I,b=Hi;if(null===b)return a;var c=this.diagram;if(Ii!==c.model.dataFormat)return a;var d=c.model,e=!1,f=!1,g=null;try{d.rm()&&(e=d.dk,d.dk=this.copiesParentKey),d.nk()&&(f=d.ck,d.ck=this.copiesGroupKey),g=c.ek(b,c,!1)}finally{for(d.rm()&&(d.dk=e),d.nk()&&(d.ck=f),b=g.iterator;b.next();)c=b.value,d=b.key,c.location.s()||(d.location.s()?c.location=d.location:!c.position.s()&&d.position.s()&&(c.position=d.position)),a.add(c)}return a};
Zk.prototype.pasteSelection=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.currentCursor="wait";b.V("ChangingSelection",b.selection);b.Ea("Paste");var c=this.pasteFromClipboard();0<c.count&&b.clearSelection(!0);for(var d=c.iterator;d.next();)d.value.isSelected=!0;if(null!==a){var e=b.computePartsBounds(b.selection);if(e.s()){var f=this.computeEffectiveCollection(b.selection,b.Bn);vf(b,f,new K(a.x-e.centerX,a.y-e.centerY),b.Bn,!1)}}b.V("ClipboardPasted",c)}finally{b.cb("Paste"),b.V("ChangedSelection",
b.selection),b.currentCursor=""}};Zk.prototype.canPasteSelection=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.allowClipboard||null===Hi||0===Hi.count||Ii!==a.model.dataFormat?!1:!0};Zk.prototype.undo=function(){this.diagram.undoManager.undo()};Zk.prototype.canUndo=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly?!1:a.allowUndo&&a.undoManager.canUndo()};Zk.prototype.redo=function(){this.diagram.undoManager.redo()};
Zk.prototype.canRedo=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly?!1:a.allowUndo&&a.undoManager.canRedo()};Zk.prototype.decreaseZoom=function(a){void 0===a&&(a=1/this.zoomFactor);E(a,Zk,"decreaseZoom:factor");var b=this.diagram;b.autoScale===zh&&(a=b.scale*a,a<b.minScale||a>b.maxScale||(b.scale=a))};
Zk.prototype.canDecreaseZoom=function(a){void 0===a&&(a=1/this.zoomFactor);E(a,Zk,"canDecreaseZoom:factor");var b=this.diagram;if(b.autoScale!==zh)return!1;a=b.scale*a;return a<b.minScale||a>b.maxScale?!1:b.allowZoom};Zk.prototype.increaseZoom=function(a){void 0===a&&(a=this.zoomFactor);E(a,Zk,"increaseZoom:factor");var b=this.diagram;b.autoScale===zh&&(a=b.scale*a,a<b.minScale||a>b.maxScale||(b.scale=a))};
Zk.prototype.canIncreaseZoom=function(a){void 0===a&&(a=this.zoomFactor);E(a,Zk,"canIncreaseZoom:factor");var b=this.diagram;if(b.autoScale!==zh)return!1;a=b.scale*a;return a<b.minScale||a>b.maxScale?!1:b.allowZoom};Zk.prototype.resetZoom=function(a){void 0===a&&(a=this.defaultScale);E(a,Zk,"resetZoom:newscale");var b=this.diagram;a<b.minScale||a>b.maxScale||(b.scale=a)};
Zk.prototype.canResetZoom=function(a){void 0===a&&(a=this.defaultScale);E(a,Zk,"canResetZoom:newscale");var b=this.diagram;return a<b.minScale||a>b.maxScale?!1:b.allowZoom};
Zk.prototype.zoomToFit=function(){var a=this.diagram,b=a.animationManager;b.wc();a.redraw();var c=a.position,d=a.scale;th(b,"Zoom To Fit");this.isZoomToFitRestoreEnabled&&d===this.Du&&!isNaN(this.$t)&&a.documentBounds.B(this.Cu)?(a.scale=this.$t,a.position=this.ex,this.Du=NaN,this.Cu=pc):(this.$t=d,this.ex=c.copy(),a.zoomToFit(),this.Du=a.scale,this.Cu=a.documentBounds.copy());vh(b)};Zk.prototype.canZoomToFit=function(){return this.diagram.allowZoom};
Zk.prototype.scrollToPart=function(a){void 0===a&&(a=null);null!==a&&w(a,U,Zk,"part");var b=this.diagram;b.Ya();if(null===a){try{null!==this.pg&&(this.pg.next()?a=this.pg.value:this.pg=null)}catch(k){this.pg=null}null===a&&(0<b.highlighteds.count?this.pg=b.highlighteds.iterator:0<b.selection.count&&(this.pg=b.selection.iterator),null!==this.pg&&this.pg.next()&&(a=this.pg.value))}if(null!==a){var c=b.animationManager;th(c,"Scroll To Part");var d=this.scrollToPartPause;if(0<d){var e=al(this,a,[a]);
if(1===e.length)b.Ea(),b.xs(a.actualBounds),b.cb("Scroll To Part");else{var f=function(){b.Ea();for(var a=e.pop();0<e.length&&a instanceof V&&a.isTreeExpanded&&(!(a instanceof yf)||a.isSubGraphExpanded);)a=e.pop();0<e.length?(a instanceof U&&b.Tv(a.actualBounds),a instanceof V&&!a.isTreeExpanded&&(a.isTreeExpanded=!0),a instanceof yf&&!a.isSubGraphExpanded&&(a.isSubGraphExpanded=!0)):(a instanceof U&&b.xs(a.actualBounds),b.ym("LayoutCompleted",g));b.cb("Scroll To Part")},g=function(){va(f,(c.isEnabled?
c.duration:0)+d)};b.Xj("LayoutCompleted",g);f()}}else{var h=b.position.copy();b.xs(a.actualBounds);h.Za(b.position)&&c.wc()}}};
function al(a,b,c){if(b.isVisible())return c;if(b instanceof Ke)al(a,b.adornedPart,c);else if(b instanceof R){var d=b.fromNode;null!==d&&al(a,d,c);b=b.toNode;null!==b&&al(a,b,c)}else b instanceof V&&(d=b.labeledLink,null!==d&&al(a,d,c),d=b.Cg(),null!==d&&(d.isTreeExpanded||d.wasTreeExpanded||c.push(d),al(a,d,c))),b=b.containingGroup,null!==b&&(b.isSubGraphExpanded||b.wasSubGraphExpanded||c.push(b),al(a,b,c));return c}
Zk.prototype.canScrollToPart=function(a){void 0===a&&(a=null);if(null!==a&&!(a instanceof U))return!1;a=this.diagram;return 0===a.selection.count&&0===a.highlighteds.count?!1:a.allowHorizontalScroll&&a.allowVerticalScroll};
Zk.prototype.collapseTree=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.Ea("Collapse Tree");th(b.animationManager,"Collapse Tree");var c=new H;if(null!==a&&a.isTreeExpanded)a.collapseTree(),c.add(a);else if(null===a)for(var d=b.selection.iterator;d.next();){var e=d.value;e instanceof V&&e.isTreeExpanded&&(e.collapseTree(),c.add(e))}b.V("TreeCollapsed",c)}finally{b.cb("Collapse Tree")}};
Zk.prototype.canCollapseTree=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a){if(!(a instanceof V&&a.isTreeExpanded))return!1;if(0<a.kq().count)return!0}else for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof V&&b.isTreeExpanded&&0<b.kq().count)return!0;return!1};
Zk.prototype.expandTree=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.Ea("Expand Tree");th(b.animationManager,"Expand Tree");var c=new H;if(null!==a&&!a.isTreeExpanded)a.expandTree(),c.add(a);else if(null===a)for(var d=b.selection.iterator;d.next();){var e=d.value;e instanceof V&&!e.isTreeExpanded&&(e.expandTree(),c.add(e))}b.V("TreeExpanded",c)}finally{b.cb("Expand Tree")}};
Zk.prototype.canExpandTree=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a){if(!(a instanceof V)||a.isTreeExpanded)return!1;if(0<a.kq().count)return!0}else for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof V&&!b.isTreeExpanded&&0<b.kq().count)return!0;return!1};
Zk.prototype.groupSelection=function(){var a=this.diagram,b=a.model;if(b.Zi()){var c=this.archetypeGroupData;if(null!==c){var d=null;try{a.currentCursor="wait";a.V("ChangingSelection",a.selection);a.Ea("Group");for(var e=new H,f=a.selection.iterator;f.next();){var g=f.value;g.Tc()&&g.canGroup()&&e.add(g)}for(var h=new H,k=e.iterator;k.next();){var l=k.value;f=!1;for(var m=e.iterator;m.next();)if(l.Pd(m.value)){f=!0;break}f||h.add(l)}if(0<h.count){var n=h.first().containingGroup;if(null!==n)for(;null!==
n;){e=!1;for(var p=h.iterator;p.next();)if(!p.value.Pd(n)){e=!0;break}if(e)n=n.containingGroup;else break}if(c instanceof yf)og(c),d=c.copy(),null!==d&&a.add(d);else if(b.Os(c)){var r=b.copyNodeData(c);Ga(r)&&(b.Ef(r),d=a.Ri(r))}if(null!==d){null!==n&&this.isValidMember(n,d)&&(d.containingGroup=n);for(var q=h.iterator;q.next();){var u=q.value;this.isValidMember(d,u)&&(u.containingGroup=d)}a.clearSelection(!0);d.isSelected=!0}}a.V("SelectionGrouped",d)}finally{a.cb("Group"),a.V("ChangedSelection",
a.selection),a.currentCursor=""}}}};Zk.prototype.canGroupSelection=function(){var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.allowGroup||!a.model.Zi()||null===this.archetypeGroupData)return!1;for(a=a.selection.iterator;a.next();){var b=a.value;if(b.Tc()&&b.canGroup())return!0}return!1};
function bl(a){var b=Na();for(a=a.iterator;a.next();){var c=a.value;c instanceof R||b.push(c)}a=new I;c=b.length;for(var d=0;d<c;d++){for(var e=b[d],f=!0,g=0;g<c;g++)if(e.Pd(b[g])){f=!1;break}f&&a.add(e)}Pa(b);return a}
Zk.prototype.isValidMember=function(a,b){if(null===b||a===b||b instanceof R)return!1;if(null!==a){if(a===b||a.Pd(b))return!1;var c=a.memberValidation;if(null!==c&&!c(a,b)||null===a.data&&null!==b.data||null!==a.data&&null===b.data)return!1}c=this.memberValidation;return null!==c?c(a,b):!0};
Zk.prototype.ungroupSelection=function(a){void 0===a&&(a=null);var b=this.diagram,c=b.model;if(c.Zi())try{b.currentCursor="wait";b.V("ChangingSelection",b.selection);b.Ea("Ungroup");var d=new H;if(null!==a)d.add(a);else for(var e=b.selection.iterator;e.next();){var f=e.value;f instanceof yf&&f.canUngroup()&&d.add(f)}var g=new H;if(0<d.count){b.clearSelection(!0);for(var h=d.iterator;h.next();){var k=h.value;k.expandSubGraph();var l=k.containingGroup,m=null!==l&&null!==l.data?c.va(l.data):void 0;g.addAll(k.memberParts);
for(var n=g.iterator;n.next();){var p=n.value;p.isSelected=!0;if(!(p instanceof R)){var r=p.data;null!==r?c.Hq(r,m):p.containingGroup=l}}b.remove(k)}}b.V("SelectionUngrouped",d,g)}finally{b.cb("Ungroup"),b.V("ChangedSelection",b.selection),b.currentCursor=""}};
Zk.prototype.canUngroupSelection=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly||b.isModelReadOnly||!b.allowDelete||!b.allowUngroup||!b.model.Zi())return!1;if(null!==a){if(!(a instanceof yf))return!1;if(a.canUngroup())return!0}else for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof yf&&b.canUngroup())return!0;return!1};
Zk.prototype.addTopLevelParts=function(a,b){var c=!0;for(a=bl(a).iterator;a.next();){var d=a.value;null!==d.containingGroup&&(!b||this.isValidMember(null,d)?d.containingGroup=null:c=!1)}return c};
Zk.prototype.collapseSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.Ea("Collapse SubGraph");th(b.animationManager,"Collapse SubGraph");var c=new H;if(null!==a&&a.isSubGraphExpanded)a.collapseSubGraph(),c.add(a);else if(null===a)for(var d=b.selection.iterator;d.next();){var e=d.value;e instanceof yf&&e.isSubGraphExpanded&&(e.collapseSubGraph(),c.add(e))}b.V("SubGraphCollapsed",c)}finally{b.cb("Collapse SubGraph")}};
Zk.prototype.canCollapseSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a)return a instanceof yf&&a.isSubGraphExpanded?!0:!1;for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof yf&&b.isSubGraphExpanded)return!0;return!1};
Zk.prototype.expandSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.Ea("Expand SubGraph");th(b.animationManager,"Expand SubGraph");var c=new H;if(null!==a&&!a.isSubGraphExpanded)a.expandSubGraph(),c.add(a);else if(null===a)for(var d=b.selection.iterator;d.next();){var e=d.value;e instanceof yf&&!e.isSubGraphExpanded&&(e.expandSubGraph(),c.add(e))}b.V("SubGraphExpanded",c)}finally{b.cb("Expand SubGraph")}};
Zk.prototype.canExpandSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a)return a instanceof yf&&!a.isSubGraphExpanded?!0:!1;for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof yf&&!b.isSubGraphExpanded)return!0;return!1};
Zk.prototype.editTextBlock=function(a){void 0===a&&(a=null);null!==a&&w(a,Yg,Zk,"editTextBlock");var b=this.diagram,c=b.toolManager.findTool("TextEditing");if(null!==c){if(null===a){a=null;for(var d=b.selection.iterator;d.next();){var e=d.value;if(e.canEdit()){a=e;break}}if(null===a)return;a=a.lm(function(a){return a instanceof Yg&&a.editable})}null!==a&&(b.currentTool=null,c.textBlock=a,b.currentTool=c)}};
Zk.prototype.canEditTextBlock=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly||b.isModelReadOnly||!b.allowTextEdit||null===b.toolManager.findTool("TextEditing"))return!1;if(null!==a){if(!(a instanceof Yg))return!1;a=a.part;if(null!==a&&a.canEdit())return!0}else for(b=b.selection.iterator;b.next();)if(a=b.value,a.canEdit()&&(a=a.lm(function(a){return a instanceof Yg&&a.editable}),null!==a))return!0;return!1};
Zk.prototype.showContextMenu=function(a){var b=this.diagram,c=b.toolManager.findTool("ContextMenu");if(null!==c&&(void 0===a&&(a=0<b.selection.count?b.selection.first():b),a=c.findObjectWithContextMenu(a),null!==a)){var d=b.lastInput,e=null;a instanceof O?e=a.ja(Ic):b.viewportBounds.ca(d.documentPoint)||(e=b.viewportBounds,e=new K(e.x+e.width/2,e.y+e.height/2));null!==e&&(d.viewPoint=b.Jq(e),d.documentPoint=e,d.left=!1,d.right=!0,d.up=!0);b.currentTool=c;Ug(c,!1,a)}};
Zk.prototype.canShowContextMenu=function(a){var b=this.diagram,c=b.toolManager.findTool("ContextMenu");if(null===c)return!1;void 0===a&&(a=0<b.selection.count?b.selection.first():b);return null===c.findObjectWithContextMenu(a)?!1:!0};
Zk.prototype.computeEffectiveCollection=function(a,b){var c=this.diagram,d=c.toolManager.findTool("Dragging"),e=c.currentTool===d;void 0===b&&(b=e?d.dragOptions:c.Bn);d=new yb;if(null===a)return d;for(var f=a.iterator;f.next();)Qj(c,d,f.value,e,b);if(null!==c.draggedLink&&b.dragsLink)return d;for(f=a.iterator;f.next();)a=f.value,a instanceof R&&(b=a.fromNode,null===b||d.contains(b)?(b=a.toNode,null===b||d.contains(b)||d.remove(a)):d.remove(a));return d};
na.Object.defineProperties(Zk.prototype,{diagram:{configurable:!0,get:function(){return this.D}},copiesClipboardData:{configurable:!0,get:function(){return this.o},set:function(a){A(a,"boolean",Zk,"copiesClipboardData");this.o=a}},copiesConnectedLinks:{configurable:!0,get:function(){return this.F},set:function(a){A(a,"boolean",Zk,"copiesConnectedLinks");this.F=a}},deletesConnectedLinks:{configurable:!0,get:function(){return this.Ra},set:function(a){A(a,
"boolean",Zk,"deletesConnectedLinks");this.Ra=a}},copiesTree:{configurable:!0,get:function(){return this.Ha},set:function(a){A(a,"boolean",Zk,"copiesTree");this.Ha=a}},deletesTree:{configurable:!0,get:function(){return this.Vb},set:function(a){A(a,"boolean",Zk,"deletesTree");this.Vb=a}},copiesParentKey:{configurable:!0,get:function(){return this.Da},set:function(a){A(a,"boolean",Zk,"copiesParentKey");this.Da=a}},copiesGroupKey:{configurable:!0,
get:function(){return this.O},set:function(a){A(a,"boolean",Zk,"copiesGroupKey");this.O=a}},archetypeGroupData:{configurable:!0,get:function(){return this.j},set:function(a){null!==a&&A(a,"object",Zk,"archetypeGroupData");var b=this.diagram;G&&(b=b.model,!b.Zi()||a instanceof yf||b.Os(a)||v("CommandHandler.archetypeGroupData must be either a Group or a data object for which GraphLinksModel.isGroupForNodeData is true: "+a));this.j=a}},memberValidation:{configurable:!0,get:function(){return this.wi},
set:function(a){null!==a&&A(a,"function",Zk,"memberValidation");this.wi=a}},defaultScale:{configurable:!0,get:function(){return this.diagram.defaultScale},set:function(a){this.diagram.defaultScale=a}},zoomFactor:{configurable:!0,get:function(){return this.xc},set:function(a){E(a,Zk,"zoomFactor");1<a||v("zoomFactor must be larger than 1.0, not: "+a);this.xc=a}},isZoomToFitRestoreEnabled:{configurable:!0,get:function(){return this.Mb},set:function(a){A(a,"boolean",
Zk,"isZoomToFitRestoreEnabled");this.Mb=a}},scrollToPartPause:{configurable:!0,get:function(){return this.Wb},set:function(a){E(a,Zk,"scrollToPartPause");this.Wb=a}}});Zk.className="CommandHandler";Gi=function(){return new Zk};
function O(){ab(this);this.H=4225027;this.rb=1;this.ng=null;this.ta="";this.pd=this.Zb=null;this.pa=(new K(NaN,NaN)).freeze();this.$c=Xb;this.kg=Pb;this.jg=Wb;this.Ab=new Jb;this.Yh=new Jb;this.Gb=null;this.ya=this.cl=1;this.Eb=0;this.Qe=cl;this.gh=zc;this.rc=(new M(NaN,NaN,NaN,NaN)).freeze();this.Cb=(new M(NaN,NaN,NaN,NaN)).freeze();this.Ac=(new M(0,0,NaN,NaN)).freeze();this.T=this.bp=this.cp=null;this.Ik=this.Db=dd;this.op=0;this.pp=1;this.Ng=0;this.ln=1;this.Gp=null;this.tp=-Infinity;this.Ml=0;
this.Nl=zb;this.Ol=dg;this.di="";this.lb=this.S=null;this.Ok=-1;this.Ql=this.hb=this.ci=this.Ul=null;this.Wr=pg;this.rp=this.Ig=this.Nj=null}var Bd,pg,rg,cl,dl,el,fl,gl,hl,il;
O.prototype.cloneProtected=function(a){a.H=this.H|6144;a.rb=this.rb;a.ta=this.ta;a.Zb=this.Zb;a.pd=this.pd;a.Ig=this.Ig;a.pa.assign(this.pa);a.$c=this.$c.L();a.kg=this.kg.L();a.jg=this.jg.L();null!==this.Gb?a.Gb=this.Gb.copy():a.Gb=null;a.ya=this.ya;a.Eb=this.Eb;a.Qe=this.Qe;a.gh=this.gh.L();a.rc.assign(this.rc);a.Cb.assign(this.Cb);a.Ac.assign(this.Ac);a.bp=this.bp;null!==this.T&&(a.T=this.T.copy());a.Db=this.Db.L();a.Ik=this.Ik.L();a.op=this.op;a.pp=this.pp;a.Ng=this.Ng;a.ln=this.ln;a.Gp=this.Gp;
a.tp=this.tp;a.Ml=this.Ml;a.Nl=this.Nl.L();a.Ol=this.Ol;a.di=this.di;null!==this.S&&(a.S=this.S.copy());a.lb=this.lb;a.Ok=this.Ok;null!==this.ci&&(a.ci=Ja(this.ci));null!==this.hb&&(a.hb=this.hb.copy());a.Ql=this.Ql};O.prototype.Hx=function(a){var b=this.ci;if(Ha(b))for(var c=0;c<b.length;c++){if(b[c]===a)return}else this.ci=b=[];b.push(a)};O.prototype.If=function(a){a.cp=null;a.Nj=null;a.v()};
O.prototype.clone=function(){var a=new this.constructor;this.cloneProtected(a);if(null!==this.ci)for(var b=0;b<this.ci.length;b++){var c=this.ci[b];a[c]=this[c]}return a};O.prototype.copy=function(){return this.clone()};t=O.prototype;t.mb=function(a){a.classType===R?0===a.name.indexOf("Orient")?this.segmentOrientation=a:v("Unknown Link enum value for GraphObject.segmentOrientation property: "+a):a.classType===O?this.stretch=a:Ea(this,a)};t.toString=function(){return Qa(this.constructor)+"#"+lb(this)};
function jl(a){null===a.S&&(a.S=new kl)}t.Rc=function(){if(null===this.T){var a=new ll;a.$g=Bc;a.Eh=Bc;a.Yg=10;a.Ch=10;a.Zg=0;a.Dh=0;this.T=a}};
t.bb=function(a,b,c,d,e,f,g){var h=this.part;if(null!==h&&(h.zk(a,b,c,d,e,f,g),c===this&&a===se&&ml(this)&&nl(this,h,b),f=this.diagram,null===this.Ig||null===f||!f.$i||f.undoManager.isUndoingRedoing||f.animationManager.fn||(a=this.Ig.get(b),null!==a&&f.animationManager.isEnabled&&!f.animationManager.isTicking&&(null===this.rp&&(this.rp=new yb),g=0===f.undoManager.transactionLevel,a.startCondition===ji?g=!0:a.startCondition===li&&(g=!1),g?(f=new sh,ki(a,f),g=this.rp.get(a),null!==g&&g.stop(),this.rp.add(a,
f),f.Au=this,f.zx=a,f.add(this,b,d,e),f.start()):(th(f.animationManager,"Trigger"),f.animationManager.defaultAnimation.add(this,b,d,e)))),this instanceof X&&c===h&&0!==(h.H&16777216)&&null!==h.data))for(c=this.W.m,d=c.length,e=0;e<d;e++)h=c[e],h instanceof X&&Ij(h,function(a){null!==a.data&&0!==(a.H&16777216)&&a.Ka(b)})};
function nl(a,b,c){var d=a.Nh();if(null!==d)for(var e=a.lb.iterator;e.next();){var f=e.value,g=null;if(null!==f.sourceName){g=ol(f,d,a);if(null===g)continue;f.Nq(a,g,c,null)}else if(f.isToModel){var h=b.diagram;null===h||h.skipsModelSourceBindings||f.Nq(a,h.model.modelData,c,d)}else{h=d.data;if(null===h)continue;var k=b.diagram;null===k||k.skipsModelSourceBindings||f.Nq(a,h,c,d)}g===a&&(h=d.Bs(f.ij),null!==h&&f.iw(h,g,c))}}t.Bs=function(a){return this.Ok===a?this:null};
t.g=function(a,b,c){this.bb(se,a,this,b,c)};t.Ie=function(a,b,c,d){var e=this.rc;e.h(a,b,c,d);if(1!==this.ya||0!==this.Eb){null===this.Gb&&(this.Gb=new Jb);var f=this.Gb;f.reset();this.Ap(f,a,b,c,d);f.Kq(e)}};function pl(a,b,c,d){if(!1===a.pickable)return!1;d.multiply(a.transform);return c?a.Sc(b,d):a.Lh(b,d)}
t.ey=function(a,b,c){if(!1===this.pickable)return!1;var d=this.naturalBounds;b=a.Jf(b);return c?Lb(a.x,a.y,0,0,0,d.height)<=b||Lb(a.x,a.y,0,d.height,d.width,d.height)<=b||Lb(a.x,a.y,d.width,d.height,d.width,0)<=b||Lb(a.x,a.y,d.width,0,0,0)<=b:a.wd(0,0)<=b&&a.wd(0,d.height)<=b&&a.wd(d.width,0)<=b&&a.wd(d.width,d.height)<=b};t.re=function(){return!0};
t.ca=function(a){G&&w(a,K,O,"containsPoint:p");var b=K.alloc();b.assign(a);this.transform.Ga(b);var c=this.actualBounds;if(!c.s())return K.free(b),!1;var d=this.diagram;if(null!==d&&d.Zt){var e=d.om("extraTouchThreshold"),f=d.om("extraTouchArea"),g=f/2,h=this.naturalBounds;d=this.Mf()*d.scale;var k=1/d;if(h.width*d<e&&h.height*d<e)return a=jc(c.x-g*k,c.y-g*k,c.width+f*k,c.height+f*k,b.x,b.y),K.free(b),a}e=!1;if(this instanceof Ke||this instanceof Kf?jc(c.x-5,c.y-5,c.width+10,c.height+10,b.x,b.y):
c.ca(b))this.hb&&!this.hb.ca(b)?e=!1:null!==this.pd&&c.ca(b)?e=!0:null!==this.Zb&&this.Ac.ca(a)?e=!0:e=this.Mh(a);K.free(b);return e};t.Mh=function(a){var b=this.naturalBounds;return jc(0,0,b.width,b.height,a.x,a.y)};
t.Te=function(a){if(0===this.angle)return this.actualBounds.Te(a);var b=this.naturalBounds;b=M.allocAt(0,0,b.width,b.height);var c=this.transform,d=!1,e=K.allocAt(a.x,a.y);b.ca(c.Od(e))&&(e.h(a.x,a.bottom),b.ca(c.Od(e))&&(e.h(a.right,a.bottom),b.ca(c.Od(e))&&(e.h(a.right,a.y),b.ca(c.Od(e))&&(d=!0))));K.free(e);M.free(b);return d};
t.Lh=function(a,b){G&&w(a,M,O,"containedInRect:r");if(void 0===b)return a.Te(this.actualBounds);var c=this.naturalBounds,d=!1,e=K.allocAt(0,0);a.ca(b.Ga(e))&&(e.h(0,c.height),a.ca(b.Ga(e))&&(e.h(c.width,c.height),a.ca(b.Ga(e))&&(e.h(c.width,0),a.ca(b.Ga(e))&&(d=!0))));K.free(e);return d};
t.Sc=function(a,b){G&&w(a,M,O,"intersectsRect:r");if(void 0===b&&(b=this.transform,0===this.angle))return a.Sc(this.actualBounds);var c=this.naturalBounds,d=K.allocAt(0,0),e=K.allocAt(0,c.height),f=K.allocAt(c.width,c.height),g=K.allocAt(c.width,0),h=!1;if(a.ca(b.Ga(d))||a.ca(b.Ga(e))||a.ca(b.Ga(f))||a.ca(b.Ga(g)))h=!0;else{c=M.allocAt(0,0,c.width,c.height);var k=K.allocAt(a.x,a.y);c.ca(b.Od(k))?h=!0:(k.h(a.x,a.bottom),c.ca(b.Od(k))?h=!0:(k.h(a.right,a.bottom),c.ca(b.Od(k))?h=!0:(k.h(a.right,a.y),
c.ca(b.Od(k))&&(h=!0))));K.free(k);M.free(c);!h&&(L.Ls(a,d,e)||L.Ls(a,e,f)||L.Ls(a,f,g)||L.Ls(a,g,d))&&(h=!0)}K.free(d);K.free(e);K.free(f);K.free(g);return h};t.ja=function(a,b){void 0===b&&(b=new K);if(a instanceof Ib){G&&a.ec()&&v("getDocumentPoint:s Spot must be specific: "+a.toString());var c=this.naturalBounds;b.h(a.x*c.width+a.offsetX,a.y*c.height+a.offsetY)}else b.set(a);this.ne.Ga(b);return b};
t.Wi=function(a){void 0===a&&(a=new M);var b=this.naturalBounds,c=this.ne,d=K.allocAt(0,0).transform(c);a.h(d.x,d.y,0,0);d.h(b.width,0).transform(c);ic(a,d.x,d.y,0,0);d.h(b.width,b.height).transform(c);ic(a,d.x,d.y,0,0);d.h(0,b.height).transform(c);ic(a,d.x,d.y,0,0);K.free(d);return a};t.Vi=function(){var a=this.ne;1===a.m11&&0===a.m12?a=0:(a=180*Math.atan2(a.m12,a.m11)/Math.PI,0>a&&(a+=360));return a};
t.Mf=function(){if(0!==(this.H&4096)===!1)return this.cl;var a=this.ya;return null!==this.panel?a*this.panel.Mf():a};t.Hs=function(a,b){void 0===b&&(b=new K);b.assign(a);this.ne.Od(b);return b};t.Is=function(a,b,c){return this.kk(a.x,a.y,b.x,b.y,c)};
t.kk=function(a,b,c,d,e){var f=this.transform,g=1/(f.m11*f.m22-f.m12*f.m21),h=f.m22*g,k=-f.m12*g,l=-f.m21*g,m=f.m11*g,n=g*(f.m21*f.dy-f.m22*f.dx),p=g*(f.m12*f.dx-f.m11*f.dy);if(null!==this.areaBackground)return f=this.actualBounds,L.Of(f.left,f.top,f.right,f.bottom,a,b,c,d,e);g=a*h+b*l+n;a=a*k+b*m+p;b=c*h+d*l+n;c=c*k+d*m+p;e.h(0,0);d=this.naturalBounds;c=L.Of(0,0,d.width,d.height,g,a,b,c,e);e.transform(f);return c};
O.prototype.measure=function(a,b,c,d){if(!1!==vj(this)){var e=this.gh,f=e.right+e.left;e=e.top+e.bottom;a=Math.max(a-f,0);b=Math.max(b-e,0);c=Math.max((c||0)-f,0);d=Math.max((d||0)-e,0);f=this.angle;e=this.desiredSize;var g=0;this instanceof Kf&&(g=this.strokeWidth);90===f||270===f?(a=isFinite(e.height)?e.height+g:a,b=isFinite(e.width)?e.width+g:b):(a=isFinite(e.width)?e.width+g:a,b=isFinite(e.height)?e.height+g:b);e=c||0;g=d||0;var h=this instanceof X;switch(ql(this,!0)){case pg:g=e=0;h&&(b=a=Infinity);
break;case Bd:isFinite(a)&&a>c&&(e=a);isFinite(b)&&b>d&&(g=b);break;case dl:isFinite(a)&&a>c&&(e=a);g=0;h&&(b=Infinity);break;case el:isFinite(b)&&b>d&&(g=b),e=0,h&&(a=Infinity)}h=this.maxSize;var k=this.minSize;e>h.width&&k.width<h.width&&(e=h.width);g>h.height&&k.height<h.height&&(g=h.height);c=Math.max(e/this.scale,k.width);d=Math.max(g/this.scale,k.height);h.width<c&&(c=Math.min(k.width,c));h.height<d&&(d=Math.min(k.height,d));a=Math.min(h.width,a);b=Math.min(h.height,b);a=Math.max(c,a);b=Math.max(d,
b);if(90===f||270===f)f=a,a=b,b=f,f=c,c=d,d=f;this.rc.ka();this.um(a,b,c,d);this.rc.freeze();this.rc.s()||v("Non-real measuredBounds has been set. Object "+this+", measuredBounds: "+this.rc.toString());qj(this,!1)}};O.prototype.um=function(){};O.prototype.bj=function(){return!1};
O.prototype.arrange=function(a,b,c,d,e){this.ol();var f=M.alloc();f.assign(this.Cb);this.Cb.ka();!1===wj(this)?this.Cb.h(a,b,c,d):this.Kh(a,b,c,d);this.Cb.freeze();void 0===e?this.hb=null:this.hb=e;c=!1;if(void 0!==e)c=!0;else if(e=this.panel,null===e||e.type!==X.TableRow&&e.type!==X.TableColumn||(e=e.panel),null!==e&&(e=e.Ac,d=this.measuredBounds,null!==this.areaBackground&&(d=this.Cb),c=b+d.height,d=a+d.width,c=!(0<=a+.05&&d<=e.width+.05&&0<=b+.05&&c<=e.height+.05),this instanceof Yg&&(a=this.naturalBounds,
this.Ir>a.height||this.xb>a.width)))c=!0;this.H=c?this.H|256:this.H&-257;this.Cb.s()||v("Non-real actualBounds has been set. Object "+this+", actualBounds: "+this.Cb.toString());this.vm(f,this.Cb);rl(this,!1);M.free(f)};t=O.prototype;t.Kh=function(){};
function sl(a,b,c,d,e){a.Cb.h(b,c,d,e);if(!a.desiredSize.s()){var f=a.rc;c=a.gh;b=c.right+c.left;var g=c.top+c.bottom;c=f.width+b;f=f.height+g;d+=b;e+=g;b=ql(a,!0);c===d&&f===e&&(b=pg);switch(b){case pg:if(c>d||f>e)qj(a,!0),a.measure(c>d?d:c,f>e?e:f,0,0);break;case Bd:qj(a,!0);a.measure(d,e,0,0);break;case dl:qj(a,!0);a.measure(d,f,0,0);break;case el:qj(a,!0),a.measure(c,e,0,0)}}}
t.vm=function(a,b){var c=this.part;null!==c&&null!==c.diagram&&(c.selectionObject!==this&&c.resizeObject!==this&&c.rotateObject!==this||tl(c,!0),this.R(),dc(a,b)||(c.Rh(),this.Ro(c)))};t.Ro=function(a){null!==this.portId&&(tl(a,!0),a instanceof V&&ul(a,this))};
t.uc=function(a,b){if(this.visible){var c=this.opacity;if(0!==c){var d=this instanceof X&&(this.type===X.TableRow||this.type===X.TableColumn),e=this.Cb;if(d||0!==e.width&&0!==e.height&&!isNaN(e.x)&&!isNaN(e.y)){var f=1;1!==c&&(f=a.globalAlpha,a.globalAlpha=f*c);if(d){e=this.Cb;d=this.Ac;var g=this.pd,h=this.Zb;null===g&&null===h||a.Ld();null!==g&&(pi(this,a,g,!0,!0,d,e),g instanceof vl&&g.type===wl?(a.beginPath(),a.rect(e.x,e.y,e.width,e.height),a.Kf(g)):a.fillRect(e.x,e.y,e.width,e.height));null!==
h&&(pi(this,a,h,!0,!1,d,e),h instanceof vl&&h.type===wl?(a.beginPath(),a.rect(e.x,e.y,e.width,e.height),a.Kf(h)):a.fillRect(e.x,e.y,e.width,e.height));this.Pi(a,b)}else if(!this.Xx(a,b)){this instanceof R&&this.rk(!1);G&&G.gm&&G.Sz&&G.Sz(a,this);d=this.transform;g=this.panel;0!==(this.H&4096)===!0&&xl(this);var k=this.part;h=!1;var l=0;if(k&&b.Ve("drawShadows")&&(h=k.isShadowed)){var m=k.shadowOffset;l=Math.max(m.y,m.x)*b.scale*b.jc}m=this.bj();var n;if(!(n=b.zj||!m)){var p=this.naturalBounds;n=this.Yh;
var r=n.m11,q=n.m21,u=n.dx,x=n.m12,y=n.m22,z=n.dy,B,D=B=0;n=B*r+D*q+u;var C=B*x+D*y+z;B=p.width+l;D=0;var J=B*r+D*q+u;B=B*x+D*y+z;D=Math.min(n,J);var S=Math.min(C,B);var T=Math.max(n+0,J)-D;var aa=Math.max(C+0,B)-S;n=D;C=S;B=p.width+l;D=p.height+l;J=B*r+D*q+u;B=B*x+D*y+z;D=Math.min(n,J);S=Math.min(C,B);T=Math.max(n+T,J)-D;aa=Math.max(C+aa,B)-S;n=D;C=S;B=0;D=p.height+l;J=B*r+D*q+u;B=B*x+D*y+z;D=Math.min(n,J);S=Math.min(C,B);T=Math.max(n+T,J)-D;aa=Math.max(C+aa,B)-S;n=D;C=S;l=b.viewportBounds;p=l.x;
r=l.y;n=!(n>l.width+p||p>T+n||C>l.height+r||r>aa+C)}if(n){n=0!==(this.H&256);a.clipInsteadOfFill&&(n=!1);this instanceof Yg&&(a.font=this.font);if(n){C=g.re()?g.naturalBounds:g.actualBounds;null!==this.hb?(p=this.hb,T=p.x,aa=p.y,l=p.width,p=p.height):(T=Math.max(e.x,C.x),aa=Math.max(e.y,C.y),l=Math.min(e.right,C.right)-T,p=Math.min(e.bottom,C.bottom)-aa);if(T>e.width+e.x||e.x>C.width+C.x){1!==c&&(a.globalAlpha=f);return}a.save();a.beginPath();a.rect(T,aa,l,p);a.clip()}if(m){if(!k.isVisible()){1!==
c&&(a.globalAlpha=f);return}h&&(C=k.shadowOffset,a.$v(C.x*b.scale*b.jc,C.y*b.scale*b.jc,k.shadowBlur),yl(a),a.shadowColor=k.shadowColor)}h&&!0===this.shadowVisible?yl(a):h&&!1===this.shadowVisible&&zl(a);k=this.naturalBounds;null!==this.pd&&(a.Ld(),pi(this,a,this.pd,!0,!0,k,e),this.pd instanceof vl&&this.pd.type===wl?(a.beginPath(),a.rect(e.x,e.y,e.width,e.height),a.Kf(this.pd)):a.fillRect(e.x,e.y,e.width,e.height));a.transform(d.m11,d.m12,d.m21,d.m22,d.dx,d.dy);h&&(null!==g&&0!==(g.H&512)||null!==
g&&(g.type===X.Auto||g.type===X.Spot)&&g.ub()!==this)&&null===this.shadowVisible&&zl(a);null!==this.Zb&&(a.Ld(),Al(this,a,k,e));G&&G.gm&&G.Tz&&G.Tz(a,this);h&&(null!==this.Zb||null!==this.pd||null!==g&&0!==(g.H&512)||null!==g&&(g.type===X.Auto||g.type===X.Spot)&&g.ub()!==this)?(Bl(this,!0),null===this.shadowVisible&&zl(a)):Bl(this,!1);this.Pi(a,b);h&&0!==(this.H&512)===!0&&yl(a);m&&h&&zl(a);n&&(a.restore(),a.Oc(this instanceof X));d.Ps()||(b=1/(d.m11*d.m22-d.m12*d.m21),a.transform(d.m22*b,-d.m12*
b,-d.m21*b,d.m11*b,b*(d.m21*d.dy-d.m22*d.dx),b*(d.m12*d.dx-d.m11*d.dy)))}}1!==c&&(a.globalAlpha=f)}}}};function Al(a,b,c,d){var e=a.naturalBounds,f=0,g=0,h=e.width;e=e.height;var k=a.$w();a instanceof Kf&&(e=a.sa.bounds,f=e.x,g=e.y,h=e.width,e=e.height);pi(a,b,a.Zb,!0,!1,c,d);a.Zb instanceof vl&&a.Zb.type===wl?(b.beginPath(),b.rect(f-k/2,g-k/2,h+k,e+k),b.Kf(a.Zb)):b.fillRect(f-k/2,g-k/2,h+k,e+k)}t.Xx=function(){return!1};t.Pi=function(){};
function pi(a,b,c,d,e,f,g){if(null!==c){var h=1,k=1;if("string"===typeof c)d?b.fillStyle=c:b.strokeStyle=c;else if(c.type===Cl)d?b.fillStyle=c.color:b.strokeStyle=c.color;else{var l=0;a instanceof Kf&&(l=a.strokeWidth);h=f.width;k=f.height;e?(h=g.width,k=g.height):d||(h+=l,k+=l);if((f=b instanceof Dl)&&c.xe&&(c.type===El||c.Rk===h&&c.Ft===k))var m=c.xe;else{var n=0,p=0,r=0,q=0,u=0,x=0;x=u=0;e?(u=g.x,x=g.y):d||(u-=l/2,x-=l/2);n=c.start.x*h+c.start.offsetX;p=c.start.y*k+c.start.offsetY;r=c.end.x*h+
c.end.offsetX;q=c.end.y*k+c.end.offsetY;n+=u;r+=u;p+=x;q+=x;if(c.type===Fl)m=b.createLinearGradient(n,p,r,q);else if(c.type===wl)x=isNaN(c.endRadius)?Math.max(h,k)/2:c.endRadius,isNaN(c.startRadius)?(u=0,x=Math.max(h,k)/2):u=c.startRadius,m=b.createRadialGradient(n,p,u,r,q,x);else if(c.type===El)try{m=b.createPattern(c.pattern,"repeat")}catch(z){m=null}else za(c.type,"Brush type");if(c.type!==El&&(e=c.colorStops,null!==e))for(e=e.iterator;e.next();)m.addColorStop(e.key,e.value);if(f&&(c.xe=m,null!==
m&&(c.Rk=h,c.Ft=k),null===m&&c.type===El&&-1!==c.Rk)){c.Rk=-1;var y=a.diagram;null!==y&&-1===c.Rk&&va(function(){y.redraw()},600)}}d?b.fillStyle=m:b.strokeStyle=m}}}t.Dg=function(a){if(a instanceof X)a:{if(this!==a&&null!==a)for(var b=this.panel;null!==b;){if(b===a){a=!0;break a}b=b.panel}a=!1}else a=!1;return a};t.Rf=function(){if(!this.visible)return!1;var a=this.panel;return null!==a?a.Rf():!0};
t.Qf=function(){for(var a=this instanceof X?this:this.panel;null!==a&&a.isEnabled;)a=a.panel;return null===a};
function xl(a){if(0!==(a.H&2048)===!0){var b=a.Ab;b.reset();if(!a.Cb.s()||!a.rc.s()){Gl(a,!1);return}b.translate(a.Cb.x-a.rc.x,a.Cb.y-a.rc.y);if(1!==a.scale||0!==a.angle){var c=a.naturalBounds;a.Ap(b,c.x,c.y,c.width,c.height)}Gl(a,!1);Hl(a,!0)}0!==(a.H&4096)===!0&&(b=a.panel,null===b?(a.Yh.set(a.Ab),a.cl=a.scale,Hl(a,!1)):null!==b.ne&&(c=a.Yh,c.reset(),b.re()?c.multiply(b.Yh):null!==b.panel&&c.multiply(b.panel.Yh),c.multiply(a.Ab),a.cl=a.scale*b.cl,Hl(a,!1)))}
t.Ap=function(a,b,c,d,e){1!==this.ya&&a.scale(this.ya);if(0!==this.Eb){var f=K.alloc();f.fj(b,c,d,e,Ic);a.rotate(this.Eb,f.x,f.y);K.free(f)}};t.v=function(a){if(!vj(this)){void 0===a&&(a=!1);qj(this,!0);rl(this,!0);var b=this.panel;null===b||a||b.v()}};t.mk=function(){vj(this)||(qj(this,!0),rl(this,!0))};function Il(a){if(!wj(a)){var b=a.panel;null!==b?b.v():a.bj()&&(b=a.diagram,null!==b&&(b.De.add(a),a instanceof V&&a.yd(),b.Lb()));rl(a,!0)}}
t.ol=function(){0!==(this.H&2048)===!1&&(Gl(this,!0),Hl(this,!0))};t.qv=function(){Hl(this,!0)};t.R=function(){var a=this.part;null!==a&&a.R()};
function ql(a,b){var c=a.stretch,d=a.panel;if(null!==d&&d.type===X.Table)return Jl(a,d.getRowDefinition(a.row),d.getColumnDefinition(a.column),b);if(null!==d&&d.type===X.Auto&&d.ub()===a)return Kl(a,Bd,b);if(c===cl){if(null!==d){if(d.type===X.Spot&&d.ub()===a)return Kl(a,Bd,b);c=d.defaultStretch;return c===cl?Kl(a,pg,b):Kl(a,c,b)}return Kl(a,pg,b)}return Kl(a,c,b)}
function Jl(a,b,c,d){var e=a.stretch;if(e!==cl)return Kl(a,e,d);var f=e=null;switch(b.stretch){case el:f=!0;break;case Bd:f=!0}switch(c.stretch){case dl:e=!0;break;case Bd:e=!0}b=a.panel.defaultStretch;null===e&&(e=b===dl||b===Bd);null===f&&(f=b===el||b===Bd);return!0===e&&!0===f?Kl(a,Bd,d):!0===e?Kl(a,dl,d):!0===f?Kl(a,el,d):Kl(a,pg,d)}
function Kl(a,b,c){if(c)return b;if(b===pg)return pg;c=a.desiredSize;if(c.s())return pg;a=a.angle;if(!isNaN(c.width))if(90!==a&&270!==a){if(b===dl)return pg;if(b===Bd)return el}else{if(b===el)return pg;if(b===Bd)return dl}if(!isNaN(c.height))if(90!==a&&270!==a){if(b===el)return pg;if(b===Bd)return dl}else{if(b===dl)return pg;if(b===Bd)return el}return b}function Bl(a,b){a.H=b?a.H|512:a.H&-513}function ml(a){return 0!==(a.H&1024)}function Ll(a,b){a.H=b?a.H|1024:a.H&-1025}
function Gl(a,b){a.H=b?a.H|2048:a.H&-2049}function Hl(a,b){a.H=b?a.H|4096:a.H&-4097}function vj(a){return 0!==(a.H&8192)}function qj(a,b){a.H=b?a.H|8192:a.H&-8193}function wj(a){return 0!==(a.H&16384)}function rl(a,b){a.H=b?a.H|16384:a.H&-16385}t.dj=function(a){this.ng=a};t.gt=function(){};t.Xv=function(a){this.pa=a;Il(this);return!0};t.Km=function(a,b){if(this.pa.x!==a||this.pa.y!==b)this.pa.h(a,b),this.ol()};t.$w=function(){return 0};
function Ml(a){var b=a.part;if(b instanceof V&&(null!==a.portId||a===b.port)){var c=b.diagram;null===c||c.undoManager.isUndoingRedoing||ul(b,a)}}function Nl(a){var b=a.diagram;null===b||b.undoManager.isUndoingRedoing||(a instanceof X?a instanceof V?a.yd():a.Bk(a,function(a){Ml(a)}):Ml(a))}
t.bind=function(a,b,c,d){var e=null;"string"===typeof a?e=new Fi(a,b,c,d):e=a;e.vd=this;a=this.Nh();null!==a&&Ol(a)&&v("Cannot add a Binding to a template that has already been copied: "+e);null===this.lb&&(this.lb=new H);this.lb.add(e);return this};t.set=function(a){if(G)for(var b in a)(b.startsWith("_")||-1!==b.indexOf("."))&&v("Property with underscore or period passed to GraphObject.set. Did you mean to use GraphObject.assign?");Object.assign(this,a);return this};t.Ju=function(a){Pl(this,a);return this};
t.apply=function(a){a(this);return this};t.Lm=function(a){Cj(this,a);return this};t.gA=function(){return this.Nh()};t.Nh=function(){for(var a=this instanceof X?this:this.panel;null!==a;){if(null!==a.ai)return a;a=a.panel}return null};t.ew=function(a){a.vd=this;null===this.Ig&&(this.Ig=new yb);this.Ig.add(a.propertyName,a);return this};
function Ql(a,b){for(var c=1;c<arguments.length;++c);c=arguments;var d=null,e=null;if("function"===typeof a)e=a;else if("string"===typeof a){var f=Rl.K(a);"function"===typeof f?(c=Ja(arguments),d=f(c),Ga(d)||v('GraphObject.make invoked object builder "'+a+'", but it did not return an Object')):e=sa.go[a]}null===d&&(void 0!==e&&null!==e&&e.constructor||v("GraphObject.make requires a class function or GoJS class name or name of an object builder, not: "+a),d=new e);e=1;if(d instanceof Q&&1<c.length){f=
d;var g=c[1];if("string"===typeof g||g instanceof HTMLDivElement)Bi(f,g),e++}for(;e<c.length;e++)f=c[e],void 0===f?v("Undefined value at argument "+e+" for object being constructed by GraphObject.make: "+d):Pl(d,f);return d}
function Pl(a,b){if("string"===typeof b)if(a instanceof Yg)a.text=b;else if(a instanceof Kf)a.figure=b;else if(a instanceof ek)a.source=b;else if(a instanceof X){var c=Sl.K(b);null!==c?a.type=c:G&&v("Unknown Panel type as an argument to GraphObject.make: "+b+". If building from source, you may need to call Panel.definePanelLayout.")}else a instanceof vl?(c=cb(vl,b),null!==c?a.type=c:v("Unknown Brush type as an argument to GraphObject.make: "+b)):a instanceof N?(c=cb(N,b),null!==c?a.type=c:G&&v("Unknown Geometry type as an argument to GraphObject.make: "+
b)):a instanceof me?(c=cb(me,b),null!==c?a.type=c:G&&v("Unknown PathSegment type as an argument to GraphObject.make: "+b)):G&&v("Unable to use a string as an argument to GraphObject.make: "+b);else if(b instanceof O)a instanceof X||v("A GraphObject can only be added to a Panel, not to: "+a),a.add(b);else if(b instanceof Wj){var d;b.isRow&&"function"===typeof a.getRowDefinition?d=a.getRowDefinition(b.index):b.isRow||"function"!==typeof a.getColumnDefinition||(d=a.getColumnDefinition(b.index));d instanceof
Wj?(a=d,w(b,Wj,Wj,"copyFrom:pd"),b.isRow?a.height=b.height:a.width=b.width,a.minimum=b.minimum,a.maximum=b.maximum,a.alignment=b.alignment,a.stretch=b.stretch,a.sizing=b.sizing,a.qg=null===b.separatorPadding?null:b.separatorPadding.L(),a.separatorStroke=b.separatorStroke,a.separatorStrokeWidth=b.separatorStrokeWidth,a.Tj=null,b.separatorDashArray&&(a.Tj=Ja(b.separatorDashArray)),a.background=b.background,a.coversSeparators=b.coversSeparators,a.lb=b.lb):v("A RowColumnDefinition can only be added to an object that implements getRowDefinition/getColumnDefinition, not to: "+
a)}else if(b instanceof F)"function"===typeof a.mb?a.mb(b):Ea(a,b);else if(b instanceof Tl)a.type=b;else if(b instanceof Fi)a instanceof O?a.bind(b):a instanceof Wj?a.bind(b):v("A Binding can only be applied to a GraphObject or RowColumnDefinition, not to: "+a);else if(b instanceof hi)a instanceof O?a.ew(b):v("An AnimationTrigger can only be applied to a GraphObject, not to: "+a);else if(b instanceof le)a instanceof N?a.figures.add(b):v("A PathFigure can only be added to a Geometry, not to: "+a);
else if(b instanceof me)a instanceof le?a.segments.add(b):v("A PathSegment can only be added to a PathFigure, not to: "+a);else if(b instanceof zi)a instanceof Q?a.layout=b:a instanceof yf?a.layout=b:v("A Layout can only be assigned to a Diagram or a Group, not to: "+a);else if(Array.isArray(b))for(c=0;c<b.length;c++)Pl(a,b[c]);else if("object"===typeof b&&null!==b)if(a instanceof vl){c=new fb;for(var e in b)d=parseFloat(e),isNaN(d)?c[e]=b[e]:a.addColorStop(d,b[e]);Cj(a,c)}else if(a instanceof Wj){void 0!==
b.row?(e=b.row,(void 0===e||null===e||Infinity===e||isNaN(e)||0>e)&&v("Must specify non-negative integer row for RowColumnDefinition "+b+", not: "+e),a.isRow=!0,a.index=e):void 0!==b.column&&(e=b.column,(void 0===e||null===e||Infinity===e||isNaN(e)||0>e)&&v("Must specify non-negative integer column for RowColumnDefinition "+b+", not: "+e),a.isRow=!1,a.index=e);e=new fb;for(c in b)"row"!==c&&"column"!==c&&(e[c]=b[c]);Cj(a,e)}else Cj(a,b);else v('Unknown initializer "'+b+'" for object being constructed by GraphObject.make: '+
a)}function Ul(a,b){A(a,"string",O,"defineBuilder:name");A(b,"function",O,"defineBuilder:func");var c=a.toLowerCase();G&&(""===a||"none"===c||a===c)&&v("Shape.defineFigureGenerator name must not be empty or None or all-lower-case: "+a);Rl.add(a,b)}
function Vl(a,b,c){void 0===c&&(c=null);var d=a[1];if("function"===typeof c?c(d):"string"===typeof d)return a.splice(1,1),d;if(void 0===b)throw Error("no "+("function"===typeof c?"satisfactory":"string")+" argument for GraphObject builder "+a[0]);return b}
na.Object.defineProperties(O.prototype,{shadowVisible:{configurable:!0,get:function(){return this.Ql},set:function(a){var b=this.Ql;b!==a&&(G&&null!==a&&A(a,"boolean",O,"shadowVisible"),this.Ql=a,this.R(),this.g("shadowVisible",b,a))}},enabledChanged:{configurable:!0,get:function(){return null!==this.S?this.S.Hn:null},set:function(a){jl(this);var b=this.S.Hn;b!==a&&(null!==a&&A(a,"function",O,"enabledChanged"),this.S.Hn=a,this.g("enabledChanged",b,a))}},segmentOrientation:{configurable:!0,
enumerable:!0,get:function(){return this.Ol},set:function(a){var b=this.Ol;b!==a&&(G&&db(a,R,O,"segmentOrientation"),this.Ol=a,this.v(),this.g("segmentOrientation",b,a),a===dg&&(this.angle=0))}},segmentIndex:{configurable:!0,get:function(){return this.tp},set:function(a){G&&A(a,"number",O,"segmentIndex");a=Math.round(a);var b=this.tp;b!==a&&(this.tp=a,this.v(),this.g("segmentIndex",b,a))}},segmentFraction:{configurable:!0,get:function(){return this.Ml},set:function(a){G&&
A(a,"number",O,"segmentFraction");isNaN(a)?a=0:0>a?a=0:1<a&&(a=1);var b=this.Ml;b!==a&&(this.Ml=a,this.v(),this.g("segmentFraction",b,a))}},segmentOffset:{configurable:!0,get:function(){return this.Nl},set:function(a){var b=this.Nl;b.B(a)||(G&&w(a,K,O,"segmentOffset"),this.Nl=a=a.L(),this.v(),this.g("segmentOffset",b,a))}},stretch:{configurable:!0,get:function(){return this.Qe},set:function(a){var b=this.Qe;b!==a&&(G&&db(a,O,O,"stretch"),this.Qe=a,this.v(),this.g("stretch",
b,a))}},name:{configurable:!0,get:function(){return this.ta},set:function(a){var b=this.ta;b!==a&&(G&&A(a,"string",O,"name"),this.ta=a,null!==this.part&&(this.part.xi=null),this.g("name",b,a))}},opacity:{configurable:!0,get:function(){return this.rb},set:function(a){var b=this.rb;b!==a&&(A(a,"number",O,"opacity"),(0>a||1<a)&&Ba(a,"0 <= value <= 1",O,"opacity"),this.rb=a,this.g("opacity",b,a),a=this.diagram,b=this.part,null!==a&&null!==b&&a.R(Gj(b,b.actualBounds)))}},visible:{configurable:!0,
enumerable:!0,get:function(){return 0!==(this.H&1)},set:function(a){var b=0!==(this.H&1);b!==a&&(G&&A(a,"boolean",O,"visible"),this.H^=1,this.g("visible",b,a),b=this.panel,null!==b?b.v():this.bj()&&this.Tb(a),this.R(),Nl(this))}},pickable:{configurable:!0,get:function(){return 0!==(this.H&2)},set:function(a){var b=0!==(this.H&2);b!==a&&(G&&A(a,"boolean",O,"pickable"),this.H^=2,this.g("pickable",b,a))}},fromLinkableDuplicates:{configurable:!0,get:function(){return 0!==(this.H&
4)},set:function(a){var b=0!==(this.H&4);b!==a&&(G&&A(a,"boolean",O,"fromLinkableDuplicates"),this.H^=4,this.g("fromLinkableDuplicates",b,a))}},fromLinkableSelfNode:{configurable:!0,get:function(){return 0!==(this.H&8)},set:function(a){var b=0!==(this.H&8);b!==a&&(G&&A(a,"boolean",O,"fromLinkableSelfNode"),this.H^=8,this.g("fromLinkableSelfNode",b,a))}},toLinkableDuplicates:{configurable:!0,get:function(){return 0!==(this.H&16)},set:function(a){var b=0!==(this.H&16);b!==
a&&(G&&A(a,"boolean",O,"toLinkableDuplicates"),this.H^=16,this.g("toLinkableDuplicates",b,a))}},toLinkableSelfNode:{configurable:!0,get:function(){return 0!==(this.H&32)},set:function(a){var b=0!==(this.H&32);b!==a&&(G&&A(a,"boolean",O,"toLinkableSelfNode"),this.H^=32,this.g("toLinkableSelfNode",b,a))}},isPanelMain:{configurable:!0,get:function(){return 0!==(this.H&64)},set:function(a){var b=0!==(this.H&64);b!==a&&(G&&A(a,"boolean",O,"isPanelMain"),this.H^=64,this.v(),
this.g("isPanelMain",b,a))}},isActionable:{configurable:!0,get:function(){return 0!==(this.H&128)},set:function(a){var b=0!==(this.H&128);b!==a&&(G&&A(a,"boolean",O,"isActionable"),this.H^=128,this.g("isActionable",b,a))}},areaBackground:{configurable:!0,get:function(){return this.pd},set:function(a){var b=this.pd;b!==a&&(null!==a&&Wl(a,"GraphObject.areaBackground"),a instanceof vl&&a.freeze(),this.pd=a,this.R(),this.g("areaBackground",b,a))}},background:{configurable:!0,
enumerable:!0,get:function(){return this.Zb},set:function(a){var b=this.Zb;b!==a&&(null!==a&&Wl(a,"GraphObject.background"),a instanceof vl&&a.freeze(),this.Zb=a,this.R(),this.g("background",b,a))}},part:{configurable:!0,get:function(){if(this.bj())return this;if(null!==this.Nj)return this.Nj;var a;for(a=this.panel;a;){if(a instanceof U)return this.Nj=a;a=a.panel}return null}},svg:{configurable:!0,get:function(){return this.ns},set:function(a){this.ns=a}},panel:{configurable:!0,
enumerable:!0,get:function(){return this.ng}},layer:{configurable:!0,get:function(){var a=this.part;return null!==a?a.layer:null}},diagram:{configurable:!0,get:function(){var a=this.part;return null!==a?a.diagram:null}},position:{configurable:!0,get:function(){return this.pa},set:function(a){G&&w(a,K,O,"position");var b=a.x,c=a.y,d=this.pa,e=d.x;d=d.y;(e===b||isNaN(e)&&isNaN(b))&&(d===c||isNaN(d)&&isNaN(c))?this.gt():(a=a.copy(),this.Xv(a,e,d)&&this.g("position",
new K(e,d),a))}},actualBounds:{configurable:!0,get:function(){return this.Cb}},scale:{configurable:!0,get:function(){return this.ya},set:function(a){var b=this.ya;b!==a&&(G&&E(a,O,"scale"),0>=a&&v("GraphObject.scale for "+this+" must be greater than zero, not: "+a),this.ya=a,this.v(),this.g("scale",b,a))}},angle:{configurable:!0,get:function(){return this.Eb},set:function(a){var b=this.Eb;b!==a&&(G&&E(a,O,"angle"),a%=360,0>a&&(a+=360),b!==a&&(this.Eb=a,Nl(this),
this.v(),this.g("angle",b,a)))}},desiredSize:{configurable:!0,get:function(){return this.$c},set:function(a){G&&w(a,Hb,O,"desiredSize");var b=a.width,c=a.height,d=this.$c,e=d.width,f=d.height;(e===b||isNaN(e)&&isNaN(b))&&(f===c||isNaN(f)&&isNaN(c))||(this.$c=a=a.L(),this.v(),this instanceof Kf&&this.lc(),this.g("desiredSize",d,a),ml(this)&&(a=this.part,null!==a&&(nl(this,a,"width"),nl(this,a,"height"))))}},width:{configurable:!0,get:function(){return this.$c.width},set:function(a){var b=
this.$c.width;b===a||isNaN(b)&&isNaN(a)||(G&&A(a,"number",O,"width"),b=this.$c,this.$c=a=(new Hb(a,this.$c.height)).freeze(),this.v(),this instanceof Kf&&this.lc(),this.g("desiredSize",b,a),ml(this)&&(a=this.part,null!==a&&nl(this,a,"width")))}},height:{configurable:!0,get:function(){return this.$c.height},set:function(a){var b=this.$c.height;b===a||isNaN(b)&&isNaN(a)||(G&&A(a,"number",O,"height"),b=this.$c,this.$c=a=(new Hb(this.$c.width,a)).freeze(),this.v(),this instanceof Kf&&this.lc(),
this.g("desiredSize",b,a),ml(this)&&(a=this.part,null!==a&&nl(this,a,"height")))}},minSize:{configurable:!0,get:function(){return this.kg},set:function(a){var b=this.kg;b.B(a)||(G&&w(a,Hb,O,"minSize"),a=a.copy(),isNaN(a.width)&&(a.width=0),isNaN(a.height)&&(a.height=0),a.freeze(),this.kg=a,this.v(),this.g("minSize",b,a))}},maxSize:{configurable:!0,get:function(){return this.jg},set:function(a){var b=this.jg;b.B(a)||(G&&w(a,Hb,O,"maxSize"),a=a.copy(),isNaN(a.width)&&(a.width=
Infinity),isNaN(a.height)&&(a.height=Infinity),a.freeze(),this.jg=a,this.v(),this.g("maxSize",b,a))}},measuredBounds:{configurable:!0,get:function(){return this.rc}},naturalBounds:{configurable:!0,get:function(){return this.Ac}},margin:{configurable:!0,get:function(){return this.gh},set:function(a){"number"===typeof a?a=new fc(a):G&&w(a,fc,O,"margin");var b=this.gh;b.B(a)||(this.gh=a=a.L(),this.v(),this.g("margin",b,a))}},transform:{configurable:!0,
get:function(){0!==(this.H&2048)===!0&&xl(this);return this.Ab}},ne:{configurable:!0,get:function(){0!==(this.H&4096)===!0&&xl(this);return this.Yh}},alignment:{configurable:!0,get:function(){return this.Db},set:function(a){var b=this.Db;b.B(a)||(G&&w(a,Ib,O,"alignment"),a.ec()&&!a.Kb()&&v("GraphObject.alignment for "+this+" must be a real Spot or Spot.Default, not: "+a),this.Db=a=a.L(),Il(this),this.g("alignment",b,a))}},column:{configurable:!0,get:function(){return this.Ng},
set:function(a){G&&E(a,O,"column");a=Math.round(a);var b=this.Ng;b!==a&&(0>a&&Ba(a,">= 0",O,"column"),this.Ng=a,this.v(),this.g("column",b,a))}},columnSpan:{configurable:!0,get:function(){return this.ln},set:function(a){G&&A(a,"number",O,"columnSpan");a=Math.round(a);var b=this.ln;b!==a&&(1>a&&Ba(a,">= 1",O,"columnSpan"),this.ln=a,this.v(),this.g("columnSpan",b,a))}},row:{configurable:!0,get:function(){return this.op},set:function(a){G&&E(a,O,"row");a=Math.round(a);var b=
this.op;b!==a&&(0>a&&Ba(a,">= 0",O,"row"),this.op=a,this.v(),this.g("row",b,a))}},rowSpan:{configurable:!0,get:function(){return this.pp},set:function(a){G&&A(a,"number",O,"rowSpan");a=Math.round(a);var b=this.pp;b!==a&&(1>a&&Ba(a,">= 1",O,"rowSpan"),this.pp=a,this.v(),this.g("rowSpan",b,a))}},spanAllocation:{configurable:!0,get:function(){return this.Gp},set:function(a){var b=this.Gp;b!==a&&(null!==a&&A(a,"function",O,"spanAllocation"),this.Gp=a,this.v(),this.g("spanAllocation",
b,a))}},alignmentFocus:{configurable:!0,get:function(){return this.Ik},set:function(a){var b=this.Ik;b.B(a)||(G&&w(a,Ib,O,"alignmentFocus"),!G||!a.ec()||a.Kb()||a.sq()&&this instanceof V||v("GraphObject.alignmentFocus must be a real Spot or Spot.Default, not: "+a),this.Ik=a=a.L(),this.v(),this.g("alignmentFocus",b,a))}},portId:{configurable:!0,get:function(){return this.bp},set:function(a){var b=this.bp;if(b!==a){G&&null!==a&&A(a,"string",O,"portId");var c=this.part;null===
c||c instanceof V||v("Cannot set portID on a Link: "+a);null!==b&&null!==c&&Xl(c,this);this.bp=a;null!==a&&null!==c&&(c.We=!0,Yl(c,this));this.g("portId",b,a)}}},toSpot:{configurable:!0,get:function(){return null!==this.T?this.T.Eh:Bc},set:function(a){this.Rc();var b=this.T.Eh;b.B(a)||(G&&w(a,Ib,O,"toSpot"),a=a.L(),this.T.Eh=a,this.g("toSpot",b,a),Ml(this))}},toEndSegmentLength:{configurable:!0,get:function(){return null!==this.T?this.T.Ch:10},set:function(a){this.Rc();
var b=this.T.Ch;b!==a&&(G&&A(a,"number",O,"toEndSegmentLength"),0>a&&Ba(a,">= 0",O,"toEndSegmentLength"),this.T.Ch=a,this.g("toEndSegmentLength",b,a),Ml(this))}},toShortLength:{configurable:!0,get:function(){return null!==this.T?this.T.Dh:0},set:function(a){this.Rc();var b=this.T.Dh;b!==a&&(G&&A(a,"number",O,"toShortLength"),this.T.Dh=a,this.g("toShortLength",b,a),Ml(this))}},toLinkable:{configurable:!0,get:function(){return null!==this.T?this.T.Np:null},set:function(a){this.Rc();
var b=this.T.Np;b!==a&&(G&&null!==a&&A(a,"boolean",O,"toLinkable"),this.T.Np=a,this.g("toLinkable",b,a))}},toMaxLinks:{configurable:!0,get:function(){return null!==this.T?this.T.Op:Infinity},set:function(a){this.Rc();var b=this.T.Op;b!==a&&(G&&A(a,"number",O,"toMaxLinks"),0>a&&Ba(a,">= 0",O,"toMaxLinks"),this.T.Op=a,this.g("toMaxLinks",b,a))}},fromSpot:{configurable:!0,get:function(){return null!==this.T?this.T.$g:Bc},set:function(a){this.Rc();var b=this.T.$g;b.B(a)||(G&&
w(a,Ib,O,"fromSpot"),a=a.L(),this.T.$g=a,this.g("fromSpot",b,a),Ml(this))}},fromEndSegmentLength:{configurable:!0,get:function(){return null!==this.T?this.T.Yg:10},set:function(a){this.Rc();var b=this.T.Yg;b!==a&&(G&&A(a,"number",O,"fromEndSegmentLength"),0>a&&Ba(a,">= 0",O,"fromEndSegmentLength"),this.T.Yg=a,this.g("fromEndSegmentLength",b,a),Ml(this))}},fromShortLength:{configurable:!0,get:function(){return null!==this.T?this.T.Zg:0},set:function(a){this.Rc();var b=this.T.Zg;
b!==a&&(G&&A(a,"number",O,"fromShortLength"),this.T.Zg=a,this.g("fromShortLength",b,a),Ml(this))}},fromLinkable:{configurable:!0,get:function(){return null!==this.T?this.T.Nn:null},set:function(a){this.Rc();var b=this.T.Nn;b!==a&&(G&&null!==a&&A(a,"boolean",O,"fromLinkable"),this.T.Nn=a,this.g("fromLinkable",b,a))}},fromMaxLinks:{configurable:!0,get:function(){return null!==this.T?this.T.On:Infinity},set:function(a){this.Rc();var b=this.T.On;b!==a&&(G&&A(a,"number",O,"fromMaxLinks"),
0>a&&Ba(a,">= 0",O,"fromMaxLinks"),this.T.On=a,this.g("fromMaxLinks",b,a))}},cursor:{configurable:!0,get:function(){return this.di},set:function(a){var b=this.di;b!==a&&(A(a,"string",O,"cursor"),this.di=a,this.g("cursor",b,a))}},click:{configurable:!0,get:function(){return null!==this.S?this.S.Mg:null},set:function(a){jl(this);var b=this.S.Mg;b!==a&&(null!==a&&A(a,"function",O,"click"),this.S.Mg=a,this.g("click",b,a))}},doubleClick:{configurable:!0,get:function(){return null!==
this.S?this.S.Ug:null},set:function(a){jl(this);var b=this.S.Ug;b!==a&&(null!==a&&A(a,"function",O,"doubleClick"),this.S.Ug=a,this.g("doubleClick",b,a))}},contextClick:{configurable:!0,get:function(){return null!==this.S?this.S.Og:null},set:function(a){jl(this);var b=this.S.Og;b!==a&&(null!==a&&A(a,"function",O,"contextClick"),this.S.Og=a,this.g("contextClick",b,a))}},mouseEnter:{configurable:!0,get:function(){return null!==this.S?this.S.jh:null},set:function(a){jl(this);
var b=this.S.jh;b!==a&&(null!==a&&A(a,"function",O,"mouseEnter"),this.S.jh=a,this.g("mouseEnter",b,a))}},mouseLeave:{configurable:!0,get:function(){return null!==this.S?this.S.mh:null},set:function(a){jl(this);var b=this.S.mh;b!==a&&(null!==a&&A(a,"function",O,"mouseLeave"),this.S.mh=a,this.g("mouseLeave",b,a))}},mouseOver:{configurable:!0,get:function(){return null!==this.S?this.S.nh:null},set:function(a){jl(this);var b=this.S.nh;b!==a&&(null!==a&&A(a,"function",O,"mouseOver"),
this.S.nh=a,this.g("mouseOver",b,a))}},mouseHover:{configurable:!0,get:function(){return null!==this.S?this.S.lh:null},set:function(a){jl(this);var b=this.S.lh;b!==a&&(null!==a&&A(a,"function",O,"mouseHover"),this.S.lh=a,this.g("mouseHover",b,a))}},mouseHold:{configurable:!0,get:function(){return null!==this.S?this.S.kh:null},set:function(a){jl(this);var b=this.S.kh;b!==a&&(null!==a&&A(a,"function",O,"mouseHold"),this.S.kh=a,this.g("mouseHold",b,a))}},mouseDragEnter:{configurable:!0,
enumerable:!0,get:function(){return null!==this.S?this.S.Io:null},set:function(a){jl(this);var b=this.S.Io;b!==a&&(null!==a&&A(a,"function",O,"mouseDragEnter"),this.S.Io=a,this.g("mouseDragEnter",b,a))}},mouseDragLeave:{configurable:!0,get:function(){return null!==this.S?this.S.Jo:null},set:function(a){jl(this);var b=this.S.Jo;b!==a&&(null!==a&&A(a,"function",O,"mouseDragLeave"),this.S.Jo=a,this.g("mouseDragLeave",b,a))}},mouseDrop:{configurable:!0,get:function(){return null!==
this.S?this.S.ih:null},set:function(a){jl(this);var b=this.S.ih;b!==a&&(null!==a&&A(a,"function",O,"mouseDrop"),this.S.ih=a,this.g("mouseDrop",b,a))}},actionDown:{configurable:!0,get:function(){return null!==this.S?this.S.Xm:null},set:function(a){jl(this);var b=this.S.Xm;b!==a&&(null!==a&&A(a,"function",O,"actionDown"),this.S.Xm=a,this.g("actionDown",b,a))}},actionMove:{configurable:!0,get:function(){return null!==this.S?this.S.Ym:null},set:function(a){jl(this);var b=this.S.Ym;
b!==a&&(null!==a&&A(a,"function",O,"actionMove"),this.S.Ym=a,this.g("actionMove",b,a))}},actionUp:{configurable:!0,get:function(){return null!==this.S?this.S.Zm:null},set:function(a){jl(this);var b=this.S.Zm;b!==a&&(null!==a&&A(a,"function",O,"actionUp"),this.S.Zm=a,this.g("actionUp",b,a))}},actionCancel:{configurable:!0,get:function(){return null!==this.S?this.S.Wm:null},set:function(a){jl(this);var b=this.S.Wm;b!==a&&(null!==a&&A(a,"function",O,"actionCancel"),this.S.Wm=
a,this.g("actionCancel",b,a))}},toolTip:{configurable:!0,get:function(){return null!==this.S?this.S.Fh:null},set:function(a){jl(this);var b=this.S.Fh;b!==a&&(!G||null===a||a instanceof Ke||a instanceof Pe||v("GraphObject.toolTip must be an Adornment or HTMLInfo."),this.S.Fh=a,this.g("toolTip",b,a))}},contextMenu:{configurable:!0,get:function(){return null!==this.S?this.S.Pg:null},set:function(a){jl(this);var b=this.S.Pg;b!==a&&(!G||a instanceof Ke||a instanceof Pe||v("GraphObject.contextMenu must be an Adornment or HTMLInfo."),
this.S.Pg=a,this.g("contextMenu",b,a))}}});O.prototype.trigger=O.prototype.ew;O.prototype.findBindingPanel=O.prototype.Nh;O.prototype.findTemplateBinder=O.prototype.gA;O.prototype.setProperties=O.prototype.Lm;O.prototype.apply=O.prototype.apply;O.prototype.attach=O.prototype.Ju;O.prototype.set=O.prototype.set;O.prototype.isEnabledObject=O.prototype.Qf;O.prototype.isVisibleObject=O.prototype.Rf;O.prototype.isContainedBy=O.prototype.Dg;O.prototype.getNearestIntersectionPoint=O.prototype.Is;
O.prototype.getLocalPoint=O.prototype.Hs;O.prototype.getDocumentScale=O.prototype.Mf;O.prototype.getDocumentAngle=O.prototype.Vi;O.prototype.getDocumentBounds=O.prototype.Wi;O.prototype.getDocumentPoint=O.prototype.ja;O.prototype.intersectsRect=O.prototype.Sc;O.prototype.containedInRect=O.prototype.Lh;O.prototype.containsRect=O.prototype.Te;O.prototype.containsPoint=O.prototype.ca;O.prototype.raiseChanged=O.prototype.g;O.prototype.raiseChangedEvent=O.prototype.bb;O.prototype.addCopyProperty=O.prototype.Hx;
var Rl=null;O.className="GraphObject";Rl=new yb;
Ul("Button",function(){function a(a,b){return null!==a.diagram.dc(a.documentPoint,function(a){for(;null!==a.panel&&!a.isActionable;)a=a.panel;return a},function(a){return a===b})}var b=Ql(X,X.Auto,{isActionable:!0,enabledChanged:function(a,b){if(a instanceof X){var c=a.eb("ButtonBorder");null!==c&&(c.fill=b?a._buttonFillNormal:a._buttonFillDisabled)}},cursor:"pointer",_buttonFillNormal:"#F5F5F5",_buttonStrokeNormal:"#BDBDBD",_buttonFillOver:"#E0E0E0",_buttonStrokeOver:"#9E9E9E",_buttonFillPressed:"#BDBDBD",
_buttonStrokePressed:"#9E9E9E",_buttonFillDisabled:"#E5E5E5"},Ql(Kf,{name:"ButtonBorder",figure:"RoundedRectangle",spot1:new Ib(0,0,2.76142374915397,2.761423749153969),spot2:new Ib(1,1,-2.76142374915397,-2.761423749153969),parameter1:2,parameter2:2,fill:"#F5F5F5",stroke:"#BDBDBD"}));b.mouseEnter=function(a,b){if(b.Qf()&&b instanceof X&&(a=b.eb("ButtonBorder"),a instanceof Kf)){var c=b._buttonFillOver;b._buttonFillNormal=a.fill;a.fill=c;c=b._buttonStrokeOver;b._buttonStrokeNormal=a.stroke;a.stroke=
c}};b.mouseLeave=function(a,b){b.Qf()&&b instanceof X&&(a=b.eb("ButtonBorder"),a instanceof Kf&&(a.fill=b._buttonFillNormal,a.stroke=b._buttonStrokeNormal))};b.actionDown=function(a,b){if(b.Qf()&&b instanceof X&&null!==b._buttonFillPressed&&0===a.button){var c=b.eb("ButtonBorder");if(c instanceof Kf){a=a.diagram;var d=a.skipsUndoManager;a.skipsUndoManager=!0;var g=b._buttonFillPressed;b._buttonFillOver=c.fill;c.fill=g;g=b._buttonStrokePressed;b._buttonStrokeOver=c.stroke;c.stroke=g;a.skipsUndoManager=
d}}};b.actionUp=function(b,d){if(d.Qf()&&d instanceof X&&null!==d._buttonFillPressed&&0===b.button){var c=d.eb("ButtonBorder");if(c instanceof Kf){var f=b.diagram,g=f.skipsUndoManager;f.skipsUndoManager=!0;a(b,d)?(c.fill=d._buttonFillOver,c.stroke=d._buttonStrokeOver):(c.fill=d._buttonFillNormal,c.stroke=d._buttonStrokeNormal);f.skipsUndoManager=g}}};b.actionCancel=function(b,d){if(d.Qf()&&d instanceof X&&null!==d._buttonFillPressed){var c=d.eb("ButtonBorder");if(c instanceof Kf){var f=b.diagram,
g=f.skipsUndoManager;f.skipsUndoManager=!0;a(b,d)?(c.fill=d._buttonFillOver,c.stroke=d._buttonStrokeOver):(c.fill=d._buttonFillNormal,c.stroke=d._buttonStrokeNormal);f.skipsUndoManager=g}}};b.actionMove=function(b,d){if(d.Qf()&&d instanceof X&&null!==d._buttonFillPressed){var c=b.diagram;if(0===c.firstInput.button&&(c.currentTool.standardMouseOver(),a(b,d)&&(b=d.eb("ButtonBorder"),b instanceof Kf))){var f=c.skipsUndoManager;c.skipsUndoManager=!0;var g=d._buttonFillPressed;b.fill!==g&&(b.fill=g);g=
d._buttonStrokePressed;b.stroke!==g&&(b.stroke=g);c.skipsUndoManager=f}}};return b});
Ul("TreeExpanderButton",function(){var a=Ql("Button",{_treeExpandedFigure:"MinusLine",_treeCollapsedFigure:"PlusLine"},Ql(Kf,{name:"ButtonIcon",figure:"MinusLine",stroke:"#424242",strokeWidth:2,desiredSize:Ub},(new Fi("figure","isTreeExpanded",function(a,c){c=c.panel;return a?c._treeExpandedFigure:c._treeCollapsedFigure})).xq()),{visible:!1},(new Fi("visible","isTreeLeaf",function(a){return!a})).xq());a.click=function(a,c){c=c.part;c instanceof Ke&&(c=c.adornedPart);if(c instanceof V){var b=c.diagram;
if(null!==b){b=b.commandHandler;if(c.isTreeExpanded){if(!b.canCollapseTree(c))return}else if(!b.canExpandTree(c))return;a.handled=!0;c.isTreeExpanded?b.collapseTree(c):b.expandTree(c)}}};return a});
Ul("SubGraphExpanderButton",function(){var a=Ql("Button",{_subGraphExpandedFigure:"MinusLine",_subGraphCollapsedFigure:"PlusLine"},Ql(Kf,{name:"ButtonIcon",figure:"MinusLine",stroke:"#424242",strokeWidth:2,desiredSize:Ub},(new Fi("figure","isSubGraphExpanded",function(a,c){c=c.panel;return a?c._subGraphExpandedFigure:c._subGraphCollapsedFigure})).xq()));a.click=function(a,c){c=c.part;c instanceof Ke&&(c=c.adornedPart);if(c instanceof yf){var b=c.diagram;if(null!==b){b=b.commandHandler;if(c.isSubGraphExpanded){if(!b.canCollapseSubGraph(c))return}else if(!b.canExpandSubGraph(c))return;
a.handled=!0;c.isSubGraphExpanded?b.collapseSubGraph(c):b.expandSubGraph(c)}}};return a});Ul("ToolTip",function(){return Ql(Ke,X.Auto,{isShadowed:!0,shadowColor:"rgba(0, 0, 0, .4)",shadowOffset:new K(0,3),shadowBlur:5},Ql(Kf,{name:"Border",figure:"RoundedRectangle",parameter1:1,parameter2:1,fill:"#F5F5F5",stroke:"#F0F0F0",spot1:new Ib(0,0,4,6),spot2:new Ib(1,1,-4,-4)}))});
Ul("ContextMenu",function(){return Ql(Ke,X.Vertical,{background:"#F5F5F5",isShadowed:!0,shadowColor:"rgba(0, 0, 0, .4)",shadowOffset:new K(0,3),shadowBlur:5},new Fi("background","",function(a){return null!==a.adornedPart&&null!==a.placeholder?null:"#F5F5F5"}))});Ul("ContextMenuButton",function(){var a=Ql("Button");a.stretch=dl;var b=a.eb("ButtonBorder");b instanceof Kf&&(b.figure="Rectangle",b.strokeWidth=0,b.spot1=new Ib(0,0,2,3),b.spot2=new Ib(1,1,-2,-2));return a});
Ul("PanelExpanderButton",function(a){var b=Vl(a,"COLLAPSIBLE"),c=Ql("Button",{_buttonExpandedFigure:"M0 0 M0 6 L4 2 8 6 M8 8",_buttonCollapsedFigure:"M0 0 M0 2 L4 6 8 2 M8 8",_buttonFillNormal:"rgba(0, 0, 0, 0)",_buttonStrokeNormal:null,_buttonFillOver:"rgba(0, 0, 0, .2)",_buttonStrokeOver:null,_buttonFillPressed:"rgba(0, 0, 0, .4)",_buttonStrokePressed:null},Ql(Kf,{name:"ButtonIcon",strokeWidth:2},(new Fi("geometryString","visible",function(a){return a?c._buttonExpandedFigure:c._buttonCollapsedFigure})).xq(b)));
a=c.eb("ButtonBorder");a instanceof Kf&&(a.stroke=null,a.fill="rgba(0, 0, 0, 0)");c.click=function(a,c){var d=c.diagram;if(null!==d&&!d.isReadOnly){var e=c.Nh();null===e&&(e=c.part);null!==e&&(c=e.eb(b),null!==c&&(a.handled=!0,d.Ea("Collapse/Expand Panel"),c.visible=!c.visible,d.cb("Collapse/Expand Panel")))}};return c});
Ul("CheckBoxButton",function(a){var b=Vl(a);a=Ql("Button",{desiredSize:new Hb(14,14)},Ql(Kf,{name:"ButtonIcon",geometryString:"M0 0 M0 8.85 L4.9 13.75 16.2 2.45 M16.2 16.2",strokeWidth:2,stretch:Bd,geometryStretch:rg,visible:!1},""!==b?(new Fi("visible",b)).yy():[]));a.click=function(a,d){if(d instanceof X){var c=a.diagram;if(!(null===c||c.isReadOnly||""!==b&&c.model.isReadOnly)){a.handled=!0;var f=d.eb("ButtonIcon");c.Ea("checkbox");f.visible=!f.visible;"function"===typeof d._doClick&&d._doClick(a,
d);c.cb("checkbox")}}};return a});
Ul("CheckBox",function(a){a=Vl(a);a=Ql("CheckBoxButton",a,{name:"Button",isActionable:!1,margin:new fc(0,1,0,0)});var b=Ql(X,"Horizontal",a,{isActionable:!0,cursor:a.cursor,margin:1,_buttonFillNormal:a._buttonFillNormal,_buttonStrokeNormal:a._buttonStrokeNormal,_buttonFillOver:a._buttonFillOver,_buttonStrokeOver:a._buttonStrokeOver,_buttonFillPressed:a._buttonFillPressed,_buttonStrokePressed:a._buttonStrokePressed,_buttonFillDisabled:a._buttonFillDisabled,mouseEnter:a.mouseEnter,mouseLeave:a.mouseLeave,
actionDown:a.actionDown,actionUp:a.actionUp,actionCancel:a.actionCancel,actionMove:a.actionMove,click:a.click,_buttonClick:a.click});a.mouseEnter=null;a.mouseLeave=null;a.actionDown=null;a.actionUp=null;a.actionCancel=null;a.actionMove=null;a.click=null;return b});O.None=pg=new F(O,"None",0);O.Default=cl=new F(O,"Default",0);O.Vertical=el=new F(O,"Vertical",4);O.Horizontal=dl=new F(O,"Horizontal",5);O.Fill=Bd=new F(O,"Fill",3);O.Uniform=rg=new F(O,"Uniform",1);
O.UniformToFill=fl=new F(O,"UniformToFill",2);O.FlipVertical=gl=new F(O,"FlipVertical",1);O.FlipHorizontal=hl=new F(O,"FlipHorizontal",2);O.FlipBoth=il=new F(O,"FlipBoth",3);O.make=Ql;O.getBuilders=function(){var a=new yb,b;for(b in Rl)if(b!==b.toLowerCase()){var c=Rl.K(b);"function"===typeof c&&a.add(b,c)}a.freeze();return a};O.defineBuilder=Ul;O.takeBuilderArgument=Vl;
function kl(){this.Hn=this.Pg=this.Fh=this.Wm=this.Zm=this.Ym=this.Xm=this.ih=this.Jo=this.Io=this.kh=this.lh=this.nh=this.mh=this.jh=this.Og=this.Ug=this.Mg=null}kl.prototype.copy=function(){var a=new kl;a.Mg=this.Mg;a.Ug=this.Ug;a.Og=this.Og;a.jh=this.jh;a.mh=this.mh;a.nh=this.nh;a.lh=this.lh;a.kh=this.kh;a.Io=this.Io;a.Jo=this.Jo;a.ih=this.ih;a.Xm=this.Xm;a.Ym=this.Ym;a.Zm=this.Zm;a.Wm=this.Wm;a.Fh=this.Fh;a.Pg=this.Pg;a.Hn=this.Hn;return a};kl.className="GraphObjectEventHandlers";
function Zl(){this.Ta=[1,0,0,1,0,0]}Zl.prototype.copy=function(){var a=new Zl;a.Ta[0]=this.Ta[0];a.Ta[1]=this.Ta[1];a.Ta[2]=this.Ta[2];a.Ta[3]=this.Ta[3];a.Ta[4]=this.Ta[4];a.Ta[5]=this.Ta[5];return a};Zl.prototype.translate=function(a,b){this.Ta[4]+=this.Ta[0]*a+this.Ta[2]*b;this.Ta[5]+=this.Ta[1]*a+this.Ta[3]*b};Zl.prototype.scale=function(a,b){this.Ta[0]*=a;this.Ta[1]*=a;this.Ta[2]*=b;this.Ta[3]*=b};Zl.className="STransform";
function $l(a){this.type=a;this.r2=this.y2=this.x2=this.r1=this.y1=this.x1=0;this.Qx=[];this.pattern=null}$l.prototype.addColorStop=function(a,b){this.Qx.push({offset:a,color:b})};$l.className="SGradient";
function Fj(a,b){this.ownerDocument=a=void 0===b?sa.document:b;this.RA="http://www.w3.org/2000/svg";void 0!==a&&(this.Qa=this.Ub("svg",{width:"1px",height:"1px",viewBox:"0 0 1 1"}),this.Qa.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns","http://www.w3.org/2000/svg"),this.Qa.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink"));this.gq=null;this.context=new am(this)}
Fj.prototype.resize=function(a,b,c,d){return this.width!==a||this.height!==b?(this.style.width=c+"px",this.style.height=d+"px",this.Qa.setAttributeNS(null,"width",c+"px"),this.Qa.setAttributeNS(null,"height",d+"px"),this.Qa.setAttributeNS(null,"viewBox","0 0 "+c+" "+d),this.context.jx.firstElementChild.setAttributeNS(null,"width",c+"px"),this.context.jx.firstElementChild.setAttributeNS(null,"height",d+"px"),!0):!1};
Fj.prototype.Ub=function(a,b,c){a=this.ownerDocument.createElementNS(this.RA,a);if(Ga(b))for(var d in b)a.setAttributeNS("href"===d?"http://www.w3.org/1999/xlink":"",d,b[d]);void 0!==c&&(a.textContent=c);return a};Fj.prototype.getBoundingClientRect=function(){return this.Qa.getBoundingClientRect()};Fj.prototype.focus=function(){this.Qa.focus()};Fj.prototype.Wx=function(){this.ownerDocument=null};
na.Object.defineProperties(Fj.prototype,{width:{configurable:!0,get:function(){return this.Qa.width.baseVal.value},set:function(a){this.Qa.width=a}},height:{configurable:!0,get:function(){return this.Qa.height.baseVal.value},set:function(a){this.Qa.height=a}},style:{configurable:!0,get:function(){return this.Qa.style}}});Fj.className="SVGSurface";
function am(a){this.it=a;this.svg=a.Qa;this.stack=[];this.nd=[];this.fillStyle="#000000";this.font="10px sans-serif";this.globalAlpha=1;this.lineCap="butt";this.lineDashOffset=0;this.lineJoin="miter";this.lineWidth=1;this.miterLimit=10;this.shadowBlur=0;this.shadowColor="rgba(0, 0, 0, 0)";this.shadowOffsetY=this.shadowOffsetX=0;this.strokeStyle="#000000";this.textAlign="start";this.clipInsteadOfFill=!1;this.sg=this.fs=this.es=0;this.Rs=null;this.path=[];this.Ut=!1;this.xh=null;this.yh=0;this.Ue=new Zl;
bm(this,1,0,0,1,0,0);var b=qb++,c=this.Ub("clipPath",{id:"mainClip"+b});c.appendChild(this.Ub("rect",{x:0,y:0,width:a.width,height:a.height}));this.jx=c;this.it.Qa.appendChild(c);this.nd[0].setAttributeNS(null,"clip-path","url(#mainClip"+b+")");this.TA={}}t=am.prototype;
t.arc=function(a,b,c,d,e,f,g,h){var k=2*Math.PI,l=k-1E-6,m=c*Math.cos(d),n=c*Math.sin(d),p=a+m,r=b+n,q=f?0:1;d=f?d-e:e-d;(1E-6<Math.abs(g-p)||1E-6<Math.abs(h-r))&&this.path.push(["L",p,+r]);0>d&&(d=d%k+k);d>l?(this.path.push(["A",c,c,0,1,q,a-m,b-n]),this.path.push(["A",c,c,0,1,q,p,r])):1E-6<d&&this.path.push(["A",c,c,0,+(d>=Math.PI),q,a+c*Math.cos(e),b+c*Math.sin(e)])};t.beginPath=function(){this.path=[]};t.bezierCurveTo=function(a,b,c,d,e,f){this.path.push(["C",a,b,c,d,e,f])};t.clearRect=function(){};
t.clip=function(){this.addPath("clipPath",this.path,this.Ue)};t.closePath=function(){this.path.push(["z"])};t.createLinearGradient=function(a,b,c,d){var e=new $l("linear");e.x1=a;e.y1=b;e.x2=c;e.y2=d;return e};
t.createPattern=function(a){var b="";a instanceof HTMLCanvasElement&&(b=a.toDataURL());a instanceof HTMLImageElement&&(b=a.getAttribute("src"));var c=this.TA;if(c[b])return"url(#"+c[b]+")";var d="PATTERN"+qb++,e={x:0,y:0,width:a.width,height:a.height,href:b};a=this.Ub("pattern",{width:a.width,height:a.height,id:d,patternUnits:"userSpaceOnUse"});a.appendChild(this.Ub(Hk,e));this.svg.appendChild(a);c[b]=d;return"url(#"+d+")"};
t.createRadialGradient=function(a,b,c,d,e,f){var g=new $l("radial");g.x1=a;g.y1=b;g.r1=c;g.x2=d;g.y2=e;g.r2=f;return g};
t.drawImage=function(a,b,c,d,e,f,g,h,k){var l="";a instanceof HTMLCanvasElement&&(l=a.toDataURL());a instanceof HTMLImageElement&&(l=a.getAttribute("src"));var m=a instanceof HTMLImageElement?a.naturalWidth:a.width,n=a instanceof HTMLImageElement?a.naturalHeight:a.height;void 0===d&&(f=b,g=c,h=d=m,k=e=n);d=d||0;e=e||0;f=f||0;g=g||0;h=h||0;k=k||0;a={x:0,y:0,width:m||d,height:n||e,href:l};L.da(d,h)&&L.da(e,k)?-1===l.toLowerCase().indexOf(".svg")&&-1===l.toLowerCase().indexOf("data:image/svg")&&(a.preserveAspectRatio=
"xMidYMid slice"):a.preserveAspectRatio="none";l="";h/=d;k/=e;if(0!==f||0!==g)l+=" translate("+f+", "+g+")";if(1!==h||1!==k)l+=" scale("+h+", "+k+")";if(0!==b||0!==c)l+=" translate("+-b+", "+-c+")";if(0!==b||0!==c||d!==m||e!==n)f="CLIP"+qb++,g=this.Ub("clipPath",{id:f}),g.appendChild(this.Ub("rect",{x:b,y:c,width:d,height:e})),this.svg.appendChild(g),a["clip-path"]="url(#"+f+")";cm(this,Hk,a,this.Ue,l);this.addElement(Hk,a)};t.fill=function(){this.addPath("fill",this.path,this.Ue)};
t.Kf=function(){this.clipInsteadOfFill?this.clip():this.fill()};t.fillRect=function(a,b,c,d){a=[a,b,c,d];a={x:a[0],y:a[1],width:a[2],height:a[3]};cm(this,"fill",a,this.Ue);this.addElement("rect",a)};t.fillText=function(a,b,c){a=[a,b,c];b=this.textAlign;"left"===b?b="start":"right"===b?b="end":"center"===b&&(b="middle");b={x:a[1],y:a[2],style:"font: "+this.font,"text-anchor":b};cm(this,"fill",b,this.Ue);this.addElement("text",b,a[0])};t.lineTo=function(a,b){this.path.push(["L",a,b])};
t.moveTo=function(a,b){this.path.push(["M",a,b])};t.quadraticCurveTo=function(a,b,c,d){this.path.push(["Q",a,b,c,d])};t.rect=function(a,b,c,d){this.path.push(["M",a,b],["L",a+c,b],["L",a+c,b+d],["L",a,b+d],["z"])};
t.restore=function(){this.Ue=this.stack.pop();this.path=this.stack.pop();var a=this.stack.pop();this.fillStyle=a.fillStyle;this.font=a.font;this.globalAlpha=a.globalAlpha;this.lineCap=a.lineCap;this.lineDashOffset=a.lineDashOffset;this.lineJoin=a.lineJoin;this.lineWidth=a.lineWidth;this.miterLimit=a.miterLimit;this.shadowBlur=a.shadowBlur;this.shadowColor=a.shadowColor;this.shadowOffsetX=a.shadowOffsetX;this.shadowOffsetY=a.shadowOffsetY;this.strokeStyle=a.strokeStyle;this.textAlign=a.textAlign};
t.save=function(){this.stack.push({fillStyle:this.fillStyle,font:this.font,globalAlpha:this.globalAlpha,lineCap:this.lineCap,lineDashOffset:this.lineDashOffset,lineJoin:this.lineJoin,lineWidth:this.lineWidth,miterLimit:this.miterLimit,shadowBlur:this.shadowBlur,shadowColor:this.shadowColor,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,strokeStyle:this.strokeStyle,textAlign:this.textAlign});for(var a=[],b=0;b<this.path.length;b++)a.push(this.path[b]);this.stack.push(a);this.stack.push(this.Ue.copy())};
t.setTransform=function(a,b,c,d,e,f){1===a&&0===b&&0===c&&1===d&&0===e&&0===f||bm(this,a,b,c,d,e,f)};t.scale=function(a,b){this.Ue.scale(a,b)};t.translate=function(a,b){this.Ue.translate(a,b)};t.transform=function(){};t.Ld=function(){};t.stroke=function(){this.addPath("stroke",this.path,this.Ue)};t.hj=function(){this.clipInsteadOfFill||this.stroke()};t.Ub=function(a,b,c){return this.it.Ub(a,b,c)};
t.addElement=function(a,b,c){a=this.Ub(a,b,c);0<this.nd.length?this.nd[this.nd.length-1].appendChild(a):this.svg.appendChild(a);return this.Rs=a};
function cm(a,b,c,d,e){1!==a.globalAlpha&&(c.opacity=a.globalAlpha);"fill"===b?(a.fillStyle instanceof $l?c.fill=dm(a,a.fillStyle):/^rgba\(/.test(a.fillStyle)?(a=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(a.fillStyle),c.fill="rgb("+a[1]+","+a[2]+","+a[3]+")",c["fill-opacity"]=a[4]):c.fill=a.fillStyle,c.stroke="none"):"stroke"===b&&(c.fill="none",a.strokeStyle instanceof $l?c.stroke=dm(a,a.strokeStyle):/^rgba\(/.test(a.strokeStyle)?(b=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(a.strokeStyle),
c.stroke="rgb("+b[1]+","+b[2]+","+b[3]+")",c["stroke-opacity"]=b[4]):c.stroke=a.strokeStyle,c["stroke-width"]=a.lineWidth,c["stroke-linecap"]=a.lineCap,c["stroke-linejoin"]=a.lineJoin,c["stroke-miterlimit"]=a.miterLimit);d=d.Ta;d="matrix("+d[0]+", "+d[1]+", "+d[2]+", "+d[3]+", "+d[4]+", "+d[5]+")";void 0!==e&&(d+=e);c.transform=d}
function dm(a,b){var c="GRAD"+qb++;if("linear"===b.type)var d=a.Ub("linearGradient",{x1:b.x1,x2:b.x2,y1:b.y1,y2:b.y2,id:c,gradientUnits:"userSpaceOnUse"});else if("radial"===b.type)d=a.Ub("radialGradient",{x1:b.x1,x2:b.x2,y1:b.y1,y2:b.y2,r1:b.r1,r2:b.r2,id:c});else throw Error("invalid gradient");var e=b.Qx;b=e.length;for(var f=[],g=0;g<b;g++){var h=e[g],k=h.color;h={offset:h.offset,"stop-color":k};/^rgba\(/.test(k)&&(k=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(k),
h["stop-color"]="rgb("+k[1]+","+k[2]+","+k[3]+")",h["stop-opacity"]=k[4]);f.push(h)}f.sort(function(a,b){return a.offset>b.offset?1:-1});for(e=0;e<b;e++)d.appendChild(a.Ub("stop",f[e]));a.svg.appendChild(d);return"url(#"+c+")"}
t.addPath=function(a,b,c){for(var d=[],e=0;e<b.length;e++){var f=Ja(b[e]),g=[f.shift()];if("A"===g[0])g.push(f.shift()+","+f.shift(),f.shift(),f.shift()+","+f.shift(),f.shift()+","+f.shift());else for(;f.length;)g.push(f.shift()+","+f.shift());d.push(g.join(" "))}b={d:d.join(" ")};"stroke"===a&&this.Ut&&(b["stroke-dasharray"]=this.xh.toString(),b["stroke-dashoffset"]=this.yh);cm(this,a,b,c);"clipPath"===a?(a="CLIP"+qb++,c=this.Ub("clipPath",{id:a}),c.appendChild(this.Ub("path",b)),this.svg.appendChild(c),
0<this.nd.length&&this.nd[this.nd.length-1].setAttributeNS(null,"clip-path","url(#"+a+")")):this.addElement("path",b)};function bm(a,b,c,d,e,f,g){var h=new Zl;h.Ta=[b,c,d,e,f,g];b={};cm(a,"g",b,h);h=a.addElement("g",b);a.nd.push(h)}
t.Nm=function(a){if(0!==this.shadowOffsetX||0!==this.shadowOffsetY||0!==this.shadowBlur){var b="SHADOW"+qb++,c=this.addElement("filter",{id:b,x:"-100%",y:"-100%",width:"300%",height:"300%"},null),d=a.computePixelRatio();a=this.Ub("feGaussianBlur",{"in":"SourceAlpha",result:"blur",stdDeviation:this.shadowBlur/2/d});var e=this.Ub("feFlood",{"in":"blur",result:"flood","flood-color":this.shadowColor}),f=this.Ub("feComposite",{"in":"flood",in2:"blur",operator:"in",result:"comp"});d=this.Ub("feOffset",
{"in":"comp",result:"offsetBlur",dx:this.shadowOffsetX/d,dy:this.shadowOffsetY/d});var g=this.Ub("feMerge",{});g.appendChild(this.Ub("feMergeNode",{"in":"offsetBlur"}));g.appendChild(this.Ub("feMergeNode",{"in":"SourceGraphic"}));c.appendChild(a);c.appendChild(e);c.appendChild(f);c.appendChild(d);c.appendChild(g);0<this.nd.length&&this.nd[this.nd.length-1].setAttributeNS(null,"filter","url(#"+b+")")}};t.$v=function(a,b,c){this.es=a;this.fs=b;this.sg=c};
function zl(a){a.shadowOffsetX=0;a.shadowOffsetY=0;a.shadowBlur=0}function yl(a){a.shadowOffsetX=a.es;a.shadowOffsetY=a.fs;a.shadowBlur=a.sg}t.As=function(a,b){this.Ut=!0;this.xh=a;this.yh=b};t.ys=function(){this.Ut=!1};t.Oc=function(){};t.Ly=function(){};am.prototype.rotate=function(){};am.prototype.getImageData=function(){return null};am.prototype.measureText=function(){return null};am.className="SVGContext";
Q.prototype.Vs=function(a){var b=new Fj(this,sa.document);void 0===a&&(a=new fb);var c=this;return Fk(this,function(a,e){a=Gk(c,a,"SVG",b);a=null!==a?a.svg:null;return"function"===typeof e?(e(a),null):a},a)};Q.prototype.makeSvg=Q.prototype.Vs;Q.prototype.yv=function(a){return this.Vs(a)};Q.prototype.makeSVG=Q.prototype.yv;
O.prototype.Xx=function(a,b){if(!(a instanceof am))return!1;var c=null,d=a.Rs,e=this.transform,f=this.panel;0!==(this.H&4096)===!0&&xl(this);var g=this.Cb,h=0!==(this.H&256);a.clipInsteadOfFill&&(h=!1);var k=!1;this instanceof Yg&&(a.font=this.font);if(h){k=f.re()?f.naturalBounds:f.actualBounds;if(null!==this.hb){var l=this.hb;var m=l.x;var n=l.y;var p=l.width;l=l.height}else m=Math.max(g.x,k.x),n=Math.max(g.y,k.y),p=Math.min(g.right,k.right)-m,l=Math.min(g.bottom,k.bottom)-n;if(m>g.width+g.x||g.x>
k.width+k.x||n>g.height+g.y||g.y>k.height+k.y)return!0;k=!0;bm(a,1,0,0,1,0,0);a.save();a.beginPath();a.rect(m,n,p,l);a.clip()}if(this.bj()&&!this.isVisible())return!0;a.Ue.Ta=[1,0,0,1,0,0];(this instanceof Yg&&1<this.lineCount||this instanceof Kf&&1<this.geometry.figures.length)&&bm(a,1,0,0,1,0,0);m=!1;this.bj()&&this.isShadowed&&b.Ve("drawShadows")&&(n=this.shadowOffset,a.$v(n.x*b.scale*b.jc,n.y*b.scale*b.jc,this.shadowBlur),yl(a),a.shadowColor=this.shadowColor);n=!1;this.part&&b.Ve("drawShadows")&&
(n=this.part.isShadowed);a.clipInsteadOfFill&&(n=!1);!0===this.shadowVisible?(yl(a),!1===m&&n&&(bm(a,1,0,0,1,0,0),a.Nm(b),m=!0)):!1===this.shadowVisible&&zl(a);p=this.naturalBounds;null!==this.areaBackground&&(pi(this,a,this.areaBackground,!0,!0,p,g),!1===m&&n&&(bm(a,1,0,0,1,0,0),a.Nm(b),m=!0),this.areaBackground instanceof vl&&this.areaBackground.type===wl?(a.beginPath(),a.rect(g.x,g.y,g.width,g.height),a.Kf(this.areaBackground)):a.fillRect(g.x,g.y,g.width,g.height));l=!1;this instanceof X?bm(a,
e.m11,e.m12,e.m21,e.m22,e.dx,e.dy):(a.Ue.Ta=[e.m11,e.m12,e.m21,e.m22,e.dx,e.dy],!1===m&&n&&(l=!0));null!==this.background&&(!1===m&&n&&(bm(a,1,0,0,1,0,0),a.Nm(b),m=!0),Al(this,a,p,g));n&&(null!==this.background||null!==this.areaBackground||null!==f&&0!==(f.H&512)||null!==f&&(f.type===X.Auto||f.type===X.Spot)&&f.ub()!==this)?(Bl(this,!0),null===this.shadowVisible&&zl(a),l=!1):Bl(this,!1);l&&!1===m&&(bm(a,1,0,0,1,0,0),a.Nm(b),m=!0);this.Pi(a,b);n&&0!==(this.H&512)===!0&&yl(a);this.bj()&&n&&zl(a);h&&
(a.restore(),k&&a.nd.pop());this instanceof X&&(c=a.nd.pop());!0===m&&a.nd.pop();if(this instanceof Yg&&1<this.lineCount||this instanceof Kf&&1<this.geometry.figures.length)c=a.nd.pop();null!==a.it.gq&&(null===c&&(d===a.Rs?(bm(a,1,0,0,1,0,0),c=a.nd.pop()):c=a.Rs),a.it.gq(this,c));this.svg=c;return!0};
function Ik(a,b){this.ownerDocument=b=void 0===b?sa.document:b;this.gq=null;b=b.createElement("canvas");b.tabIndex=0;this.Qa=b;this.Qa.innerHTML="This text is displayed if your browser does not support the Canvas HTML element.";this.context=new Dl(b);b.D=a}Ik.prototype.resize=function(a,b,c,d){return this.width!==a||this.height!==b?(this.width=a,this.height=b,this.style.width=c+"px",this.style.height=d+"px",!0):!1};Ik.prototype.toDataURL=function(a,b){return this.Qa.toDataURL(a,b)};
Ik.prototype.getBoundingClientRect=function(){return this.Qa.getBoundingClientRect()};Ik.prototype.focus=function(){this.Qa.focus()};Ik.prototype.Wx=function(){this.ownerDocument=this.Qa.D=null};na.Object.defineProperties(Ik.prototype,{width:{configurable:!0,get:function(){return this.Qa.width},set:function(a){this.Qa.width=a}},height:{configurable:!0,get:function(){return this.Qa.height},set:function(a){this.Qa.height=a}},style:{configurable:!0,get:function(){return this.Qa.style}}});
Ik.className="CanvasSurface";function Dl(a){a.getContext&&a.getContext("2d")||v("Browser does not support HTML Canvas Element");this.aa=a.getContext("2d");this.Ct=this.Et=this.Dt="";this.kn=!1;this.sg=this.fs=this.es=0;this.hm=new Jb}t=Dl.prototype;t.Ly=function(a){this.aa.imageSmoothingEnabled=a};t.arc=function(a,b,c,d,e,f){this.aa.arc(a,b,c,d,e,f)};t.beginPath=function(){this.aa.beginPath()};t.bezierCurveTo=function(a,b,c,d,e,f){this.aa.bezierCurveTo(a,b,c,d,e,f)};
t.clearRect=function(a,b,c,d){this.Ld();this.aa.clearRect(a,b,c,d)};t.clip=function(){this.aa.clip()};t.closePath=function(){this.aa.closePath()};t.createLinearGradient=function(a,b,c,d){return this.aa.createLinearGradient(a,b,c,d)};t.createPattern=function(a,b){return this.aa.createPattern(a,b)};t.createRadialGradient=function(a,b,c,d,e,f){return this.aa.createRadialGradient(a,b,c,d,e,f)};
t.drawImage=function(a,b,c,d,e,f,g,h,k){void 0===d?this.aa.drawImage(a,b,c):this.aa.drawImage(a,b,c,d,e,f,g,h,k)};t.fill=function(){this.aa.fill()};t.fillRect=function(a,b,c,d){this.aa.fillRect(a,b,c,d)};t.fillText=function(a,b,c){this.aa.fillText(a,b,c)};t.getImageData=function(a,b,c,d){return this.aa.getImageData(a,b,c,d)};t.lineTo=function(a,b){this.aa.lineTo(a,b)};t.measureText=function(a){return this.aa.measureText(a)};t.moveTo=function(a,b){this.aa.moveTo(a,b)};
t.quadraticCurveTo=function(a,b,c,d){this.aa.quadraticCurveTo(a,b,c,d)};t.rect=function(a,b,c,d){this.aa.rect(a,b,c,d)};t.restore=function(){this.aa.restore()};t.save=function(){this.Ld();this.aa.save()};Dl.prototype.rotate=function(a){this.hm.rotate(57.2958*a,0,0)};t=Dl.prototype;t.setTransform=function(a,b,c,d,e,f){this.hm.setTransform(a,b,c,d,e,f)};t.scale=function(a,b){this.hm.scale(a,b)};t.translate=function(a,b){this.hm.translate(a,b)};t.stroke=function(){this.aa.stroke()};
t.transform=function(a,b,c,d,e,f){if(1!==a||0!==b||0!==c||1!==d||0!==e||0!==f){var g=this.hm,h=g.m11*a+g.m21*b;a=g.m12*a+g.m22*b;b=g.m11*c+g.m21*d;c=g.m12*c+g.m22*d;g.dx=g.m11*e+g.m21*f+g.dx;g.dy=g.m12*e+g.m22*f+g.dy;g.m11=h;g.m12=a;g.m21=b;g.m22=c}};t.Ld=function(){var a=this.hm;this.aa.setTransform(a.m11,a.m12,a.m21,a.m22,a.dx,a.dy)};
t.Kf=function(a){if(a instanceof vl&&a.type===wl){var b=a.Rk;a=a.Ft;a>b?(this.scale(b/a,1),this.translate((a-b)/2,0)):b>a&&(this.scale(1,a/b),this.translate(0,(b-a)/2));this.kn?this.clip():this.fill();a>b?(this.translate(-(a-b)/2,0),this.scale(1/(b/a),1)):b>a&&(this.translate(0,-(b-a)/2),this.scale(1,1/(a/b)))}else this.kn?this.clip():this.fill()};t.hj=function(){this.kn||this.stroke()};t.$v=function(a,b,c){this.es=a;this.fs=b;this.sg=c};
t.As=function(a,b){var c=this.aa;void 0!==c.setLineDash&&(c.setLineDash(a),c.lineDashOffset=b)};t.ys=function(){var a=this.aa;void 0!==a.setLineDash&&(a.setLineDash(em),a.lineDashOffset=0)};t.Oc=function(a){a&&(this.Dt="");this.Ct=this.Et=""};
na.Object.defineProperties(Dl.prototype,{fillStyle:{configurable:!0,get:function(){return this.aa.fillStyle},set:function(a){this.Ct!==a&&(this.Ct=this.aa.fillStyle=a)}},font:{configurable:!0,get:function(){return this.aa.font},set:function(a){this.Dt!==a&&(this.Dt=this.aa.font=a)}},globalAlpha:{configurable:!0,get:function(){return this.aa.globalAlpha},set:function(a){this.aa.globalAlpha=a}},lineCap:{configurable:!0,get:function(){return this.aa.lineCap},
set:function(a){this.aa.lineCap=a}},lineDashOffset:{configurable:!0,get:function(){return this.aa.lineDashOffset},set:function(a){this.aa.lineDashOffset=a}},lineJoin:{configurable:!0,get:function(){return this.aa.lineJoin},set:function(a){this.aa.lineJoin=a}},lineWidth:{configurable:!0,get:function(){return this.aa.lineWidth},set:function(a){this.aa.lineWidth=a}},miterLimit:{configurable:!0,get:function(){return this.aa.miterLimit},set:function(a){this.aa.miterLimit=
a}},shadowBlur:{configurable:!0,get:function(){return this.aa.shadowBlur},set:function(a){this.aa.shadowBlur=a}},shadowColor:{configurable:!0,get:function(){return this.aa.shadowColor},set:function(a){this.aa.shadowColor=a}},shadowOffsetX:{configurable:!0,get:function(){return this.aa.shadowOffsetX},set:function(a){this.aa.shadowOffsetX=a}},shadowOffsetY:{configurable:!0,get:function(){return this.aa.shadowOffsetY},set:function(a){this.aa.shadowOffsetY=
a}},strokeStyle:{configurable:!0,get:function(){return this.aa.strokeStyle},set:function(a){this.Et!==a&&(this.Et=this.aa.strokeStyle=a)}},textAlign:{configurable:!0,get:function(){return this.aa.textAlign},set:function(a){this.aa.textAlign=a}},imageSmoothingEnabled:{configurable:!0,get:function(){return this.aa.imageSmoothingEnabled},set:function(a){this.aa.imageSmoothingEnabled=a}},clipInsteadOfFill:{configurable:!0,get:function(){return this.kn},
set:function(a){this.kn=a}}});var em=Object.freeze([]);Dl.className="CanvasSurfaceContext";function fm(){this.O=this.o=this.F=this.j=0}fm.className="ColorNumbers";
function vl(a,b){gm||(hm(),gm=!0);ab(this);this.u=!1;void 0===a?(this.na=Cl,this.Qk="black"):"string"===typeof a?(this.na=Cl,G&&!im(a)&&v('Color "'+a+'" is not a valid color string for Brush constructor'),this.Qk=a):(G&&db(a,vl,vl,"constructor:type"),this.na=a,this.Qk="black");a=this.na;a===Fl?(this.Jd=Dc,this.dl=Lc):this.dl=a===wl?this.Jd=Ic:this.Jd=Bc;this.js=0;this.jr=NaN;this.xe=this.Ur=this.we=null;this.Ft=this.Rk=0;b&&Object.assign(this,b)}
vl.prototype.copy=function(){var a=new vl;a.na=this.na;a.Qk=this.Qk;a.Jd=this.Jd.L();a.dl=this.dl.L();a.js=this.js;a.jr=this.jr;null!==this.we&&(a.we=this.we.copy());a.Ur=this.Ur;return a};t=vl.prototype;t.freeze=function(){this.u=!0;null!==this.we&&this.we.freeze();return this};t.ka=function(){Object.isFrozen(this)&&v("cannot thaw constant: "+this);this.u=!1;null!==this.we&&this.we.ka();return this};t.mb=function(a){a.classType===vl?this.type=a:Ea(this,a)};
t.toString=function(){var a="Brush(";if(this.type===Cl)a+=this.color;else if(a=this.type===Fl?a+"Linear ":this.type===wl?a+"Radial ":this.type===El?a+"Pattern ":a+"(unknown) ",a+=this.start+" "+this.end,null!==this.colorStops)for(var b=this.colorStops.iterator;b.next();)a+=" "+b.key+":"+b.value;return a+")"};
t.addColorStop=function(a,b){this.u&&xa(this);("number"!==typeof a||!isFinite(a)||1<a||0>a)&&Ba(a,"0 <= loc <= 1",vl,"addColorStop:loc");A(b,"string",vl,"addColorStop:color");G&&!im(b)&&v('Color "'+b+'" is not a valid color string for Brush.addColorStop');null===this.we&&(this.we=new yb);this.we.add(a,b);this.na===Cl&&(this.type=Fl);this.xe=null;return this};
function im(a){if("black"===a)return!0;if(""===a)return!1;G&&A(a,"string",vl,"isValidColor");gm||(hm(),gm=!0);var b=jm;if(null===b)return!0;b.fillStyle="#000000";var c=b.fillStyle;b.fillStyle=a;if(b.fillStyle!==c)return!0;b.fillStyle="#FFFFFF";c=b.fillStyle;b.fillStyle=a;return b.fillStyle!==c}
t.KA=function(a,b){this.u&&xa(this);a=void 0===a||"number"!==typeof a?.2:a;b=void 0===b?km:b;if(this.type===Cl)ci(this.color),this.color=lm(a,b);else if((this.type===Fl||this.type===wl)&&null!==this.colorStops)for(var c=this.colorStops.iterator;c.next();)ci(c.value),this.addColorStop(c.key,lm(a,b));return this};function mm(a,b,c){b=void 0===b||"number"!==typeof b?.2:b;c=void 0===c?km:c;ci(a);return lm(b,c)}
t.Kz=function(a,b){this.u&&xa(this);a=void 0===a||"number"!==typeof a?.2:a;b=void 0===b?km:b;if(this.type===Cl)ci(this.color),this.color=lm(-a,b);else if((this.type===Fl||this.type===wl)&&null!==this.colorStops)for(var c=this.colorStops.iterator;c.next();)ci(c.value),this.addColorStop(c.key,lm(-a,b));return this};function nm(a,b,c){b=void 0===b||"number"!==typeof b?.2:b;c=void 0===c?km:c;ci(a);return lm(-b,c)}
function om(a,b,c){ci(a);a=pm.j;var d=pm.F,e=pm.o,f=pm.O;ci(b);void 0===c&&(c=.5);return"rgba("+Math.round((pm.j-a)*c+a)+", "+Math.round((pm.F-d)*c+d)+", "+Math.round((pm.o-e)*c+e)+", "+Math.round((pm.O-f)*c+f)+")"}
t.uy=function(){if(this.type===Cl)return qm(this.color);if((this.type===Fl||this.type===wl)&&null!==this.colorStops){var a=this.colorStops;if(this.type===wl)return qm(a.first().value);if(null!==a.get(.5))return qm(a.get(.5));if(2===a.count)return a=a.Fa(),qm(om(a[0].value,a[1].value));for(var b=a.iterator,c=-1,d=-1,e=1,f=1;b.next();){var g=b.key,h=Math.abs(.5-b.key);e>f&&h<e?(c=g,e=h):f>=e&&h<f&&(d=g,f=h)}c>d&&(f=c,c=d,d=f,f=e);e=d-c;return qm(om(a.get(c),a.get(d),1-f/e))}return!1};
function qm(a){if(!a)return!1;if(a instanceof vl)return a.uy();ci(a);return 128>(299*pm.j+587*pm.F+114*pm.o)/1E3}
function lm(a,b){switch(b){case km:b=100*rm(pm.j);var c=100*rm(pm.F),d=100*rm(pm.o);sm.j=.4124564*b+.3575761*c+.1804375*d;sm.F=.2126729*b+.7151522*c+.072175*d;sm.o=.0193339*b+.119192*c+.9503041*d;sm.O=pm.O;b=tm(sm.j/um[0]);c=tm(sm.F/um[1]);d=tm(sm.o/um[2]);vm.j=116*c-16;vm.F=500*(b-c);vm.o=200*(c-d);vm.O=sm.O;vm.j=Math.min(100,Math.max(0,vm.j+100*a));a=(vm.j+16)/116;b=a-vm.o/200;sm.j=um[0]*wm(vm.F/500+a);sm.F=um[1]*(vm.j>xm*ym?Math.pow(a,3):vm.j/xm);sm.o=um[2]*wm(b);sm.O=vm.O;a=-.969266*sm.j+1.8760108*
sm.F+.041556*sm.o;b=.0556434*sm.j+-.2040259*sm.F+1.0572252*sm.o;pm.j=255*zm((3.2404542*sm.j+-1.5371385*sm.F+-.4985314*sm.o)/100);pm.F=255*zm(a/100);pm.o=255*zm(b/100);pm.O=sm.O;pm.j=Math.round(pm.j);255<pm.j?pm.j=255:0>pm.j&&(pm.j=0);pm.F=Math.round(pm.F);255<pm.F?pm.F=255:0>pm.F&&(pm.F=0);pm.o=Math.round(pm.o);255<pm.o?pm.o=255:0>pm.o&&(pm.o=0);return"rgba("+pm.j+", "+pm.F+", "+pm.o+", "+pm.O+")";case Am:return di(),ei.o=Math.min(100,Math.max(0,ei.o+100*a)),"hsla("+ei.j+", "+ei.F+"%, "+ei.o+"%, "+
ei.O+")";default:v("Unknown color space: "+b)}}function ci(a){gm||(hm(),gm=!0);var b=jm;if(null!==b){b.clearRect(0,0,1,1);b.fillStyle="#000000";var c=b.fillStyle;b.fillStyle=a;b.fillStyle!==c?(b.fillRect(0,0,1,1),a=b.getImageData(0,0,1,1).data,pm.j=a[0],pm.F=a[1],pm.o=a[2],pm.O=a[3]/255):(b.fillStyle="#FFFFFF",c=b.fillStyle,b.fillStyle=a,b.fillStyle===c&&G&&v('Color "'+a+'" is not a valid color string for RGBA color conversion'),pm.j=0,pm.F=0,pm.o=0,pm.O=1)}}
function di(){var a=pm.j/255,b=pm.F/255,c=pm.o/255,d=Math.max(a,b,c),e=Math.min(a,b,c),f=d-e;e=(d+e)/2;if(0===f)var g=a=0;else{switch(d){case a:g=(b-c)/f%6;break;case b:g=(c-a)/f+2;break;case c:g=(a-b)/f+4}g*=60;0>g&&(g+=360);a=f/(1-Math.abs(2*e-1))}ei.j=Math.round(g);ei.F=Math.round(100*a);ei.o=Math.round(100*e);ei.O=pm.O}function rm(a){a/=255;return.04045>=a?a/12.92:Math.pow((a+.055)/1.055,2.4)}function zm(a){return.0031308>=a?12.92*a:1.055*Math.pow(a,1/2.4)-.055}
function tm(a){return a>ym?Math.pow(a,1/3):(xm*a+16)/116}function wm(a){var b=a*a*a;return b>ym?b:(116*a-16)/xm}function Wl(a,b){"string"===typeof a?G&&!im(a)&&v('Color "'+a+'" is not a valid color string for '+b):a instanceof vl||v("Value for "+b+" must be a color string or a Brush, not "+a)}function hm(){jm=Wg?(new Ik(null)).context:null}
na.Object.defineProperties(vl.prototype,{type:{configurable:!0,get:function(){return this.na},set:function(a){this.u&&xa(this,a);db(a,vl,vl,"type");this.na=a;this.start.ec()&&(a===Fl?this.start=Dc:a===wl&&(this.start=Ic));this.end.ec()&&(a===Fl?this.end=Lc:a===wl&&(this.end=Ic));this.xe=null}},color:{configurable:!0,get:function(){return this.Qk},set:function(a){this.u&&xa(this,a);G&&!im(a)&&v('Color "'+a+'" is not a valid color string for Brush.color');this.Qk=a;this.xe=
null}},start:{configurable:!0,get:function(){return this.Jd},set:function(a){this.u&&xa(this,a);w(a,Ib,vl,"start");this.Jd=a.L();this.xe=null}},end:{configurable:!0,get:function(){return this.dl},set:function(a){this.u&&xa(this,a);w(a,Ib,vl,"end");this.dl=a.L();this.xe=null}},startRadius:{configurable:!0,get:function(){return this.js},set:function(a){this.u&&xa(this,a);E(a,vl,"startRadius");0>a&&Ba(a,">= zero",vl,"startRadius");this.js=a;this.xe=null}},endRadius:{configurable:!0,
enumerable:!0,get:function(){return this.jr},set:function(a){this.u&&xa(this,a);E(a,vl,"endRadius");0>a&&Ba(a,">= zero",vl,"endRadius");this.jr=a;this.xe=null}},colorStops:{configurable:!0,get:function(){return this.we},set:function(a){this.u&&xa(this,a);G&&w(a,yb,vl,"colorStops");this.we=a;this.xe=null}},pattern:{configurable:!0,get:function(){return this.Ur},set:function(a){this.u&&xa(this,a);this.Ur=a;this.xe=null}}});vl.prototype.isDark=vl.prototype.uy;
vl.prototype.darkenBy=vl.prototype.Kz;vl.prototype.lightenBy=vl.prototype.KA;vl.prototype.addColorStop=vl.prototype.addColorStop;var ym=216/24389,xm=24389/27,um=[95.047,100,108.883],jm=null,pm=new fm,ei=new fm,sm=new fm,vm=new fm,gm=!1;vl.className="Brush";var Cl;vl.Solid=Cl=new F(vl,"Solid",0);var Fl;vl.Linear=Fl=new F(vl,"Linear",1);var wl;vl.Radial=wl=new F(vl,"Radial",2);var El;vl.Pattern=El=new F(vl,"Pattern",4);var km;vl.Lab=km=new F(vl,"Lab",5);var Am;vl.HSL=Am=new F(vl,"HSL",6);
vl.randomColor=function(a,b){void 0===a&&(a=128);G&&(E(a,vl,"randomColor:min"),(0>a||255<a)&&Ba(a,"0 <= min <= 255",vl,"randomColor:min"));void 0===b&&(b=Math.max(a,255));G&&(E(b,vl,"randomColor:max"),(b<a||255<b)&&Ba(b,"min <= max <= 255",vl,"randomColor:max"));var c=Math.abs(b-a);b=Math.floor(a+Math.random()*c).toString(16);var d=Math.floor(a+Math.random()*c).toString(16);a=Math.floor(a+Math.random()*c).toString(16);2>b.length&&(b="0"+b);2>d.length&&(d="0"+d);2>a.length&&(a="0"+a);return"#"+b+d+
a};vl.isValidColor=im;vl.lighten=function(a){return mm(a)};vl.lightenBy=mm;vl.darken=function(a){return nm(a)};vl.darkenBy=nm;vl.mix=om;vl.isDark=qm;function Tl(){this.ta="Base"}Tl.prototype.measure=function(){};Tl.prototype.NA=function(a,b,c,d,e){a.measure(b,c,d,e)};Tl.prototype.arrange=function(){};Tl.prototype.xz=function(a,b,c,d,e,f){a.arrange(b,c,d,e,f)};Tl.prototype.XA=function(a){a.mk()};Tl.prototype.uc=function(){};
na.Object.defineProperties(Tl.prototype,{name:{configurable:!0,get:function(){return this.ta},set:function(a){this.ta=a}},classType:{configurable:!0,get:function(){return X}}});Tl.prototype.remeasureObject=Tl.prototype.XA;Tl.prototype.arrangeElement=Tl.prototype.xz;Tl.prototype.measureElement=Tl.prototype.NA;Tl.className="PanelLayout";function Bm(){this.ta="Base"}ma(Bm,Tl);
Bm.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length;a=Cm(a);for(var k=0;k<h;k++){var l=d[k];if(l.visible||l===a){var m=l.margin,n=m.right+m.left;m=m.top+m.bottom;l.measure(b,c,f,g);var p=l.measuredBounds;n=Math.max(p.width+n,0);m=Math.max(p.height+m,0);p=l.position.x;var r=l.position.y;isFinite(p)||(p=0);isFinite(r)||(r=0);l instanceof Kf&&l.isGeometryPositioned&&(l=l.strokeWidth/2,p-=l,r-=l);ic(e,p,r,n,m)}}};
Bm.prototype.arrange=function(a,b,c){var d=b.length,e=a.padding;a=c.x-e.left;c=c.y-e.top;for(e=0;e<d;e++){var f=b[e],g=f.measuredBounds,h=f.margin,k=f.position.x,l=f.position.y;k=isNaN(k)?-a:k-a;l=isNaN(l)?-c:l-c;if(f instanceof Kf&&f.isGeometryPositioned){var m=f.strokeWidth/2;k-=m;l-=m}f.visible&&f.arrange(k+h.left,l+h.top,g.width,g.height)}};function Dm(){this.ta="Base"}ma(Dm,Tl);
Dm.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length;b=Na();f=Cm(a);for(var k=0;k<h;k++){var l=d[k];if(l.visible||l===f){var m=ql(l,!1);if(m!==pg&&m!==dl)b.push(l);else{l.measure(Infinity,c,0,g);m=l.margin;l=l.measuredBounds;var n=Math.max(l.height+m.top+m.bottom,0);e.width+=Math.max(l.width+m.right+m.left,0);e.height=Math.max(e.height,n)}}}d=b.length;a.desiredSize.height?c=Math.min(a.desiredSize.height,a.maxSize.height):0!==e.height&&(c=Math.min(e.height,a.maxSize.height));for(a=0;a<d;a++)if(k=
b[a],k.visible||k===f)m=k.margin,h=m.right+m.left,m=m.top+m.bottom,k.measure(Infinity,c,0,g),k=k.measuredBounds,m=Math.max(k.height+m,0),e.width+=Math.max(k.width+h,0),e.height=Math.max(e.height,m);Pa(b)};
Dm.prototype.arrange=function(a,b,c){for(var d=b.length,e=a.padding,f=e.top,g=a.isOpposite,h=g?c.width:e.left,k=0;k<d;k++){var l=f,m=b[k];if(m.visible){var n=m.measuredBounds,p=m.margin,r=p.top+p.bottom,q=f+e.bottom,u=n.height,x=ql(m,!1);if(isNaN(m.desiredSize.height)&&x===Bd||x===el)u=Math.max(c.height-r-q,0);r=u+r+q;q=m.alignment;q.Kb()&&(q=a.defaultAlignment);q.fb()||(q=Ic);g&&(h-=n.width+p.left+p.right);m.arrange(h+q.offsetX+p.left,l+q.offsetY+p.top+(c.height*q.y-r*q.y),n.width,u);g||(h+=n.width+
p.left+p.right)}}};function Em(){this.ta="Base"}ma(Em,Tl);
Em.prototype.measure=function(a,b,c,d,e,f){var g=d.length;c=Na();for(var h=Cm(a),k=0;k<g;k++){var l=d[k];if(l.visible||l===h){var m=ql(l,!1);if(m!==pg&&m!==el)c.push(l);else{var n=l.margin;m=n.right+n.left;n=n.top+n.bottom;l.measure(b,Infinity,f,0);l=l.measuredBounds;ac(e,Math.max(e.width,Math.max(l.width+m,0)),e.height+Math.max(l.height+n,0))}}}d=c.length;if(0!==d){a.desiredSize.width?b=Math.min(a.desiredSize.width,a.maxSize.width):0!==e.width&&(b=Math.min(e.width,a.maxSize.width));for(a=0;a<d;a++)if(k=
c[a],k.visible||k===h)l=k.margin,g=l.right+l.left,l=l.top+l.bottom,k.measure(b,Infinity,f,0),k=k.measuredBounds,l=Math.max(k.height+l,0),e.width=Math.max(e.width,Math.max(k.width+g,0)),e.height+=l;Pa(c)}};
Em.prototype.arrange=function(a,b,c){for(var d=b.length,e=a.padding,f=e.left,g=a.isOpposite,h=g?c.height:e.top,k=0;k<d;k++){var l=f,m=b[k];if(m.visible){var n=m.measuredBounds,p=m.margin,r=p.left+p.right,q=f+e.right,u=n.width,x=ql(m,!1);if(isNaN(m.desiredSize.width)&&x===Bd||x===dl)u=Math.max(c.width-r-q,0);r=u+r+q;q=m.alignment;q.Kb()&&(q=a.defaultAlignment);q.fb()||(q=Ic);g&&(h-=n.height+p.bottom+p.top);m.arrange(l+q.offsetX+p.left+(c.width*q.x-r*q.x),h+q.offsetY+p.top,u,n.height);g||(h+=n.height+
p.bottom+p.top)}}};function Fm(){this.ta="Base"}ma(Fm,Tl);
Fm.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length,k=a.ub(),l=k.margin,m=l.right+l.left,n=l.top+l.bottom;k.measure(b,c,f,g);var p=k.measuredBounds;f=p.width;g=p.height;var r=Math.max(f+m,0);var q=Math.max(g+n,0);var u=a.isClipping,x=M.allocAt(-l.left,-l.top,r,q),y=M.allocAt(0,0,f,g);Gm(k,y,!0);f=y.width;g=y.height;for(var z=!0,B=Cm(a),D=0;D<h;D++){var C=d[D],J=b,S=c;if(C!==k&&(C.visible||C===B)){l=C.margin;r=l.right+l.left;q=l.top+l.bottom;p=ql(C,!1);switch(p){case Bd:J=f;S=g;break;case dl:J=
f;break;case el:S=g}C.measure(J,S,0,0);p=C.measuredBounds;r=Math.max(p.width+r,0);q=Math.max(p.height+q,0);J=C.alignment;J.Kb()&&(J=a.defaultAlignment);J.fb()||(J=Ic);var T=C.alignmentFocus;T.Kb()&&(T=Ic);S=null;C instanceof X&&""!==C.cf&&(S=C.eb(C.cf),S===C&&(S=null));var aa=y.x,W=y.y;if(null!==S){C.arrange(0,0,p.width,p.height);l=S.actualBounds;l=K.allocAt(l.x+(T.x*l.width-T.offsetX),l.y+(T.y*l.height-T.offsetY));for(S=S.panel;S!==C;)S.transform.Ga(l),S=S.panel;aa+=J.x*f+J.offsetX-l.x;W+=J.y*g+
J.offsetY-l.y;K.free(l)}else aa+=J.x*f+J.offsetX-(T.x*p.width+T.offsetX)-l.left,W+=J.y*g+J.offsetY-(T.y*p.height+T.offsetY)-l.top;z?(z=!1,e.h(aa,W,r,q)):ic(e,aa,W,r,q)}}z?e.assign(x):u?e.ov(y.x,y.y,y.width,y.height):ic(e,x.x,x.y,x.width,x.height);M.free(x);M.free(y);p=k.stretch;p===cl&&(p=ql(k,!1));switch(p){case pg:return;case Bd:if(!isFinite(b)&&!isFinite(c))return;break;case dl:if(!isFinite(b))return;break;case el:if(!isFinite(c))return}p=k.measuredBounds;f=p.width;g=p.height;r=Math.max(f+m,0);
q=Math.max(g+n,0);l=k.margin;y=M.allocAt(-l.left,-l.top,r,q);Gm(k,y,!0);f=y.width;g=y.height;for(b=0;b<h;b++)c=d[b],c===k||!c.visible&&c!==B||(l=c.margin,r=l.right+l.left,q=l.top+l.bottom,p=c.measuredBounds,r=Math.max(p.width+r,0),q=Math.max(p.height+q,0),m=c.alignment,m.Kb()&&(m=a.defaultAlignment),m.fb()||(m=Ic),c=c.alignmentFocus,c.Kb()&&(c=Ic),z?(z=!1,e.h(m.x*f+m.offsetX-(c.x*p.width+c.offsetX)-l.left,m.y*g+m.offsetY-(c.y*p.height+c.offsetY)-l.top,r,q)):ic(e,m.x*f+m.offsetX-(c.x*p.width+c.offsetX)-
l.left,m.y*g+m.offsetY-(c.y*p.height+c.offsetY)-l.top,r,q));z?e.assign(x):u?e.ov(y.x,y.y,y.width,y.height):ic(e,x.x,x.y,x.width,x.height);M.free(y)};
Fm.prototype.arrange=function(a,b,c){var d=b.length,e=a.ub(),f=e.measuredBounds,g=f.width,h=f.height,k=a.padding;f=k.left;k=k.top;var l=f-c.x,m=k-c.y;e.arrange(l,m,g,h);g=M.allocAt(0,0,g,h);Gm(e,g,!1);for(h=0;h<d;h++){var n=b[h];if(n!==e){l=n.measuredBounds;var p=l.width,r=l.height;m=n.alignment;m.Kb()&&(m=a.defaultAlignment);m.fb()||(m=Ic);var q=n.alignmentFocus;q.Kb()&&(q=Ic);l=null;n instanceof X&&""!==n.cf&&(l=n.eb(n.cf),l===n&&(l=null));if(null!==l){var u=l.actualBounds;q=K.allocAt(u.x+(q.x*
u.width-q.offsetX),u.y+(q.y*u.height-q.offsetY));for(l=l.panel;l!==n;)l.transform.Ga(q),l=l.panel;l=m.x*g.width+m.offsetX-q.x;m=m.y*g.height+m.offsetY-q.y;K.free(q)}else l=m.x*g.width+m.offsetX-(q.x*p+q.offsetX),m=m.y*g.height+m.offsetY-(q.y*r+q.offsetY);l+=g.x-c.x;m+=g.y-c.y;n.visible&&n.arrange(f+l,k+m,p,r)}}M.free(g)};
function Gm(a,b,c){var d=null;a instanceof X&&""!==a.cf&&(d=a.eb(a.cf),d===a&&(d=null));if(null!==d)for(c&&a.arrange(0,0,b.width,b.height),b.assign(d.actualBounds),d=d.panel;d!==a;)d.transform.Kq(b),d=d.panel}function Hm(){this.ta="Base"}ma(Hm,Tl);
Hm.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length,k=a.ub(),l=k.margin,m=b,n=c,p=l.right+l.left,r=l.top+l.bottom;k.measure(b,c,f,g);l=k.measuredBounds;var q=0,u=null;k instanceof Kf&&(u=k,q=u.strokeWidth*u.scale);var x=Math.max(l.width+p,0);l=Math.max(l.height+r,0);var y=Im(k),z=y.x*x+y.offsetX;y=y.y*l+y.offsetY;var B=Jm(k),D=B.x*x+B.offsetX;B=B.y*l+B.offsetY;isFinite(b)&&(m=Math.max(Math.abs(z-D)-q,0));isFinite(c)&&(n=Math.max(Math.abs(y-B)-q,0));q=Hb.alloc();q.h(0,0);a=Cm(a);for(B=0;B<
h;B++)y=d[B],y===k||!y.visible&&y!==a||(l=y.margin,x=l.right+l.left,z=l.top+l.bottom,y.measure(m,n,0,0),l=y.measuredBounds,x=Math.max(l.width+x,0),l=Math.max(l.height+z,0),q.h(Math.max(x,q.width),Math.max(l,q.height)));if(1===h)e.width=x,e.height=l,Hb.free(q);else{y=Im(k);B=Jm(k);h=d=0;B.x!==y.x&&B.y!==y.y&&(d=q.width/Math.abs(B.x-y.x),h=q.height/Math.abs(B.y-y.y));Hb.free(q);q=0;null!==u&&(q=u.strokeWidth*u.scale,qg(u)===rg&&(d=h=Math.max(d,h)));d+=Math.abs(y.offsetX)+Math.abs(B.offsetX)+q;h+=Math.abs(y.offsetY)+
Math.abs(B.offsetY)+q;u=k.stretch;u===cl&&(u=ql(k,!1));switch(u){case pg:g=f=0;break;case Bd:isFinite(b)&&(d=b);isFinite(c)&&(h=c);break;case dl:isFinite(b)&&(d=b);g=0;break;case el:f=0,isFinite(c)&&(h=c)}k.mk();k.measure(d,h,f,g);e.width=k.measuredBounds.width+p;e.height=k.measuredBounds.height+r}};
Hm.prototype.arrange=function(a,b){var c=b.length,d=a.ub(),e=d.measuredBounds,f=M.alloc();f.h(0,0,1,1);var g=d.margin,h=g.left;g=g.top;var k=a.padding,l=k.left;k=k.top;d.arrange(l+h,k+g,e.width,e.height);var m=Im(d),n=Jm(d),p=m.y*e.height+m.offsetY,r=n.x*e.width+n.offsetX;n=n.y*e.height+n.offsetY;f.x=m.x*e.width+m.offsetX;f.y=p;ic(f,r,n,0,0);f.x+=h+l;f.y+=g+k;for(e=0;e<c;e++)h=b[e],h!==d&&(l=h.measuredBounds,g=h.margin,k=Math.max(l.width+g.right+g.left,0),m=Math.max(l.height+g.top+g.bottom,0),p=h.alignment,
p.Kb()&&(p=a.defaultAlignment),p.fb()||(p=Ic),k=f.width*p.x+p.offsetX-k*p.x+g.left+f.x,g=f.height*p.y+p.offsetY-m*p.y+g.top+f.y,h.visible&&(jc(f.x,f.y,f.width,f.height,k,g,l.width,l.height)?h.arrange(k,g,l.width,l.height):h.arrange(k,g,l.width,l.height,new M(f.x,f.y,f.width,f.height))));M.free(f)};function Km(){this.ta="Base";this.name="Table"}ma(Km,Tl);
Km.prototype.measure=function(a,b,c,d,e){for(var f=d.length,g=Na(),h=Na(),k=0;k<f;k++){var l=d[k],m=l instanceof X?l:null;if(null===m||m.type!==X.TableRow&&m.type!==X.TableColumn||!l.visible)g.push(l);else{G&&(m.desiredSize.s()&&v(m.toString()+" TableRow/TableColumn Panels cannot set a desiredSize: "+m.desiredSize.toString()),m.minSize.B(Pb)||v(m.toString()+" TableRow/TableColumn Panels cannot set a minSize: "+m.minSize.toString()),m.maxSize.B(Wb)||v(m.toString()+" TableRow/TableColumn Panels cannot set a maxSize: "+
m.maxSize.toString()));h.push(m);for(var n=m.W.m,p=n.length,r=0;r<p;r++){var q=n[r];m.type===X.TableRow?q.row=l.row:m.type===X.TableColumn&&(q.column=l.column);g.push(q)}}}f=g.length;0===f&&(a.getRowDefinition(0),a.getColumnDefinition(0));for(var u=[],x=0;x<f;x++){var y=g[x];qj(y,!0);rl(y,!0);u[y.row]||(u[y.row]=[]);u[y.row][y.column]||(u[y.row][y.column]=[]);u[y.row][y.column].push(y)}Pa(g);var z=Na(),B=Na(),D=Na(),C={count:0},J={count:0},S=b,T=c,aa=a.tb;f=aa.length;for(var W=0;W<f;W++){var P=aa[W];
void 0!==P&&(P.actual=0)}aa=a.nb;f=aa.length;for(var qa=0;qa<f;qa++)P=aa[qa],void 0!==P&&(P.actual=0);for(var ia=u.length,Aa=0,Ma=0;Ma<ia;Ma++)u[Ma]&&(Aa=Math.max(Aa,u[Ma].length));var pb=Math.min(a.topIndex,ia-1),Ya=Math.min(a.leftIndex,Aa-1),Ta=0;ia=u.length;for(var Kd=Cm(a),kc=0;kc<ia;kc++)if(u[kc]){Aa=u[kc].length;var lc=a.getRowDefinition(kc);lc.actual=0;for(var vb=lc.ic=0;vb<Aa;vb++)if(u[kc][vb]){var Ld=a.getColumnDefinition(vb);void 0===z[vb]&&(Ld.actual=0,Ld.ic=0,z[vb]=!0);for(var ug=u[kc][vb],
vg=ug.length,Ve=0;Ve<vg;Ve++){var Sb=ug[Ve];if(Sb.visible||Sb===Kd){var Eh=1<Sb.rowSpan||1<Sb.columnSpan;Eh&&(kc<pb||vb<Ya||B.push(Sb));var wg=Sb.margin,Fh=wg.right+wg.left,Gh=wg.top+wg.bottom;var sb=Jl(Sb,lc,Ld,!1);var Oi=Sb.desiredSize,ok=!isNaN(Oi.height),xg=!isNaN(Oi.width)&&ok;Eh||sb===pg||xg||kc<pb||vb<Ya||(void 0!==C[vb]||sb!==Bd&&sb!==dl||(C[vb]=-1,C.count++),void 0!==J[kc]||sb!==Bd&&sb!==el||(J[kc]=-1,J.count++),D.push(Sb));Sb.measure(Infinity,Infinity,0,0);if(!(kc<pb||vb<Ya)){var xd=Sb.measuredBounds,
xc=Math.max(xd.width+Fh,0),Qf=Math.max(xd.height+Gh,0);if(1===Sb.rowSpan&&(sb===pg||sb===dl)){P=a.getRowDefinition(kc);var Ec=P.Pc();Ta=Math.max(Qf-P.actual,0);Ta+Ec>T&&(Ta=Math.max(T-Ec,0));var yg=0===P.ra;P.ic=P.ic+Ta;P.actual=P.ra+Ta;T=Math.max(T-(Ta+(yg?Ec:0)),0)}if(1===Sb.columnSpan&&(sb===pg||sb===el)){P=a.getColumnDefinition(vb);var Hh=P.Pc();Ta=Math.max(xc-P.actual,0);Ta+Hh>S&&(Ta=Math.max(S-Hh,0));var Ln=0===P.ra;P.ic=P.ic+Ta;P.actual=P.ra+Ta;S=Math.max(S-(Ta+(Ln?Hh:0)),0)}Eh&&Sb.mk()}}}}}Pa(z);
var Ud=0,Ae=0;f=a.columnCount;for(var zg=0;zg<f;zg++){var qf=a.nb[zg];void 0!==qf&&(Ud+=isNaN(qf.Cc)?qf.ic:qf.Cc,0!==qf.ic&&(Ud+=qf.Pc()))}f=a.rowCount;for(var gd=0;gd<f;gd++){var Md=a.tb[gd];void 0!==Md&&(Ae+=isNaN(Md.Cc)?Md.ic:Md.Cc,0!==Md.ic&&(Ae+=Md.Pc()))}S=Math.max(b-Ud,0);var qc=T=Math.max(c-Ae,0),Ih=S;f=D.length;for(var Jh=0;Jh<f;Jh++){var hd=D[Jh],Pi=a.getRowDefinition(hd.row),Be=a.getColumnDefinition(hd.column),rf=hd.measuredBounds,Nd=hd.margin,pk=Nd.right+Nd.left,Mn=Nd.top+Nd.bottom;C[hd.column]=
0===Be.ic&&void 0!==C[hd.column]?Math.max(rf.width+pk,C[hd.column]):null;J[hd.row]=0===Pi.ic&&void 0!==J[hd.row]?Math.max(rf.height+Mn,J[hd.row]):null}var Rf=0,Tb=0,Vd;for(Vd in J)"count"!==Vd&&(Rf+=J[Vd]);for(Vd in C)"count"!==Vd&&(Tb+=C[Vd]);for(var wb=Hb.alloc(),Qi=0;Qi<f;Qi++){var mc=D[Qi];if(mc.visible||mc===Kd){var Fc=a.getRowDefinition(mc.row),yc=a.getColumnDefinition(mc.column),Wd=0;isFinite(yc.width)?Wd=yc.width:(isFinite(S)&&null!==C[mc.column]?0===Tb?Wd=yc.actual+S:Wd=C[mc.column]/Tb*Ih:
null!==C[mc.column]?Wd=S:Wd=yc.actual||S,Wd=Math.max(0,Wd-yc.Pc()));var Xd=0;isFinite(Fc.height)?Xd=Fc.height:(isFinite(T)&&null!==J[mc.row]?0===Rf?Xd=Fc.actual+T:Xd=J[mc.row]/Rf*qc:null!==J[mc.row]?Xd=T:Xd=Fc.actual||T,Xd=Math.max(0,Xd-Fc.Pc()));wb.h(Math.max(yc.minimum,Math.min(Wd,yc.maximum)),Math.max(Fc.minimum,Math.min(Xd,Fc.maximum)));sb=Jl(mc,Fc,yc,!1);switch(sb){case dl:wb.height=Math.max(wb.height,Fc.actual+T);break;case el:wb.width=Math.max(wb.width,yc.actual+S)}var Ag=mc.margin,Mc=Ag.right+
Ag.left,Kh=Ag.top+Ag.bottom;mc.mk();mc.measure(wb.width,wb.height,yc.minimum,Fc.minimum);var Bg=mc.measuredBounds,Yd=Math.max(Bg.width+Mc,0),Lh=Math.max(Bg.height+Kh,0);isFinite(S)&&(Yd=Math.min(Yd,wb.width));isFinite(T)&&(Lh=Math.min(Lh,wb.height));var sf=0;sf=Fc.actual;Fc.actual=Math.max(Fc.actual,Lh);Fc.ic=Math.max(Fc.ic,Lh);Ta=Fc.actual-sf;T=Math.max(T-Ta,0);null===J[mc.row]&&(qc=Math.max(qc-Ta,0));sf=yc.actual;yc.actual=Math.max(yc.actual,Yd);yc.ic=Math.max(yc.ic,Yd);Ta=yc.actual-sf;S=Math.max(S-
Ta,0);null===C[mc.column]&&(Ih=Math.max(Ih-Ta,0))}}Pa(D);var Zd=Hb.alloc(),$d=Na(),ae=Na();f=B.length;if(0!==f)for(var We=0;We<ia;We++)if(u[We]){Aa=u[We].length;var Mh=a.getRowDefinition(We);$d[We]=Mh.actual;for(var Ce=0;Ce<Aa;Ce++)if(u[We][Ce]){var Nn=a.getColumnDefinition(Ce);ae[Ce]=Nn.actual}}for(var rc=0;rc<f;rc++){var bb=B[rc];if(bb.visible||bb===Kd){var sc=a.getRowDefinition(bb.row),be=a.getColumnDefinition(bb.column);wb.h(Math.max(be.minimum,Math.min(b,be.maximum)),Math.max(sc.minimum,Math.min(c,
sc.maximum)));sb=Jl(bb,sc,be,!1);switch(sb){case Bd:0!==ae[be.index]&&(wb.width=Math.min(wb.width,ae[be.index]));0!==$d[sc.index]&&(wb.height=Math.min(wb.height,$d[sc.index]));break;case dl:0!==ae[be.index]&&(wb.width=Math.min(wb.width,ae[be.index]));break;case el:0!==$d[sc.index]&&(wb.height=Math.min(wb.height,$d[sc.index]))}isFinite(be.width)&&(wb.width=be.width);isFinite(sc.height)&&(wb.height=sc.height);Zd.h(0,0);for(var Xe=be.minimum,Nh=sc.minimum,Ye=1;Ye<bb.rowSpan&&!(bb.row+Ye>=a.rowCount);Ye++)P=
a.getRowDefinition(bb.row+Ye),Ta=0,Ta=sb===Bd||sb===el?Math.max(P.minimum,0===$d[bb.row+Ye]?P.maximum:Math.min($d[bb.row+Ye],P.maximum)):Math.max(P.minimum,isNaN(P.Cc)?P.maximum:Math.min(P.Cc,P.maximum)),Zd.height+=Ta,Nh+=P.minimum;for(var Yc=1;Yc<bb.columnSpan&&!(bb.column+Yc>=a.columnCount);Yc++)P=a.getColumnDefinition(bb.column+Yc),Ta=0,Ta=sb===Bd||sb===dl?Math.max(P.minimum,0===ae[bb.column+Yc]?P.maximum:Math.min(ae[bb.column+Yc],P.maximum)):Math.max(P.minimum,isNaN(P.Cc)?P.maximum:Math.min(P.Cc,
P.maximum)),Zd.width+=Ta,Xe+=P.minimum;wb.width+=Zd.width;wb.height+=Zd.height;var tf=bb.margin,Oh=tf.right+tf.left,On=tf.top+tf.bottom;bb.measure(wb.width,wb.height,Xe,Nh);for(var Cg=bb.measuredBounds,yd=Math.max(Cg.width+Oh,0),ce=Math.max(Cg.height+On,0),De=0,Ee=0;Ee<bb.rowSpan&&!(bb.row+Ee>=a.rowCount);Ee++)P=a.getRowDefinition(bb.row+Ee),De+=P.total||0;if(De<ce){var de=ce-De,Fe=ce-De;if(null!==bb.spanAllocation)for(var qk=bb.spanAllocation,Ze=0;Ze<bb.rowSpan&&!(0>=de)&&!(bb.row+Ze>=a.rowCount);Ze++){P=
a.getRowDefinition(bb.row+Ze);var Ri=P.ra||0,Si=qk(bb,P,Fe);G&&"number"!==typeof Si&&v(bb+" spanAllocation does not return a number: "+Si);P.actual=Math.min(P.maximum,Ri+Si);P.ra!==Ri&&(de-=P.ra-Ri)}for(;0<de;){var zd=P.ra||0;isNaN(P.height)&&P.maximum>zd&&(P.actual=Math.min(P.maximum,zd+de),P.ra!==zd&&(de-=P.ra-zd));if(0===P.index)break;P=a.getRowDefinition(P.index-1)}}for(var Sf=0,Ph=0;Ph<bb.columnSpan&&!(bb.column+Ph>=a.columnCount);Ph++)P=a.getColumnDefinition(bb.column+Ph),Sf+=P.total||0;if(Sf<
yd){var Dg=yd-Sf,nu=yd-Sf;if(null!==bb.spanAllocation)for(var ou=bb.spanAllocation,rk=0;rk<bb.columnSpan&&!(0>=Dg)&&!(bb.column+rk>=a.columnCount);rk++){P=a.getColumnDefinition(bb.column+rk);var Pn=P.ra||0,Qn=ou(bb,P,nu);G&&"number"!==typeof Qn&&v(bb+" spanAllocation does not return a number: "+Qn);P.actual=Math.min(P.maximum,Pn+Qn);P.ra!==Pn&&(Dg-=P.ra-Pn)}for(;0<Dg;){var sk=P.ra||0;isNaN(P.width)&&P.maximum>sk&&(P.actual=Math.min(P.maximum,sk+Dg),P.ra!==sk&&(Dg-=P.ra-sk));if(0===P.index)break;P=
a.getColumnDefinition(P.index-1)}}}}Pa(B);Hb.free(Zd);Hb.free(wb);void 0!==$d&&Pa($d);void 0!==ae&&Pa(ae);var Eg=0,Fg=0,tk=a.desiredSize,tr=a.maxSize;sb=ql(a,!0);var Ti=Ae=Ud=0,Ui=0;f=a.columnCount;for(var uk=0;uk<f;uk++)void 0!==a.nb[uk]&&(P=a.getColumnDefinition(uk),isFinite(P.width)?(Ti+=P.width,Ti+=P.Pc()):Lm(P)===Mm?(Ti+=P.ra,Ti+=P.Pc()):0!==P.ra&&(Ud+=P.ra,Ud+=P.Pc()));isFinite(tk.width)?Eg=Math.min(tk.width,tr.width):Eg=sb!==pg&&isFinite(b)?b:Ud;Eg=Math.max(Eg,a.minSize.width);Eg=Math.max(Eg-
Ti,0);for(var pu=0===Ud?1:Math.max(Eg/Ud,1),wk=0;wk<f;wk++)void 0!==a.nb[wk]&&(P=a.getColumnDefinition(wk),isFinite(P.width)||Lm(P)===Mm||(P.actual=P.ra*pu),P.position=e.width,0!==P.ra&&(e.width+=P.ra,e.width+=P.Pc()));f=a.rowCount;for(var xk=0;xk<f;xk++)void 0!==a.tb[xk]&&(P=a.getRowDefinition(xk),isFinite(P.height)?(Ui+=P.height,Ui+=P.Pc()):Lm(P)===Mm?(Ui+=P.ra,Ui+=P.Pc()):0!==P.ra&&(Ae+=P.ra,0!==P.ra&&(Ae+=P.Pc())));isFinite(tk.height)?Fg=Math.min(tk.height,tr.height):Fg=sb!==pg&&isFinite(c)?c:
Ae;Fg=Math.max(Fg,a.minSize.height);Fg=Math.max(Fg-Ui,0);for(var qu=0===Ae?1:Math.max(Fg/Ae,1),yk=0;yk<f;yk++)void 0!==a.tb[yk]&&(P=a.getRowDefinition(yk),isFinite(P.height)||Lm(P)===Mm||(P.actual=P.ra*qu),P.position=e.height,0!==P.ra&&(e.height+=P.ra,0!==P.ra&&(e.height+=P.Pc())));f=h.length;for(var Rn=0;Rn<f;Rn++){var Ad=h[Rn],Sn=0,Tn=0;Ad.type===X.TableRow?(Sn=e.width,P=a.getRowDefinition(Ad.row),Tn=P.actual):(P=a.getColumnDefinition(Ad.column),Sn=P.actual,Tn=e.height);Ad.measuredBounds.h(0,0,
Sn,Tn);qj(Ad,!1);u[Ad.row]||(u[Ad.row]=[]);u[Ad.row][Ad.column]||(u[Ad.row][Ad.column]=[]);u[Ad.row][Ad.column].push(Ad)}Pa(h);a.qp=u};
Km.prototype.arrange=function(a,b,c){var d=b.length,e=a.padding,f=e.left;e=e.top;for(var g=a.qp,h,k,l=g.length,m=0,n=0;n<l;n++)g[n]&&(m=Math.max(m,g[n].length));for(n=Math.min(a.topIndex,l-1);n!==l&&(void 0===a.tb[n]||0===a.tb[n].ra);)n++;n=Math.min(n,l-1);n=-a.tb[n].position;for(h=Math.min(a.leftIndex,m-1);h!==m&&(void 0===a.nb[h]||0===a.nb[h].ra);)h++;h=Math.min(h,m-1);for(var p=-a.nb[h].position,r=Hb.alloc(),q=0;q<l;q++)if(g[q]){m=g[q].length;var u=a.getRowDefinition(q);k=u.position+n+e;0!==u.ra&&
(k+=u.Pu());for(var x=0;x<m;x++)if(g[q][x]){var y=a.getColumnDefinition(x);h=y.position+p+f;0!==y.ra&&(h+=y.Pu());for(var z=g[q][x],B=z.length,D=0;D<B;D++){var C=z[D],J=C.measuredBounds,S=C instanceof X?C:null;if(null===S||S.type!==X.TableRow&&S.type!==X.TableColumn){r.h(0,0);for(var T=1;T<C.rowSpan&&!(q+T>=a.rowCount);T++)S=a.getRowDefinition(q+T),r.height+=S.total;for(T=1;T<C.columnSpan&&!(x+T>=a.columnCount);T++)S=a.getColumnDefinition(x+T),r.width+=S.total;var aa=y.ra+r.width,W=u.ra+r.height;
T=h;S=k;var P=aa,qa=W,ia=h,Aa=k,Ma=aa,pb=W;h+aa>c.width&&(Ma=Math.max(c.width-h,0));k+W>c.height&&(pb=Math.max(c.height-k,0));var Ya=C.alignment;if(Ya.Kb()){Ya=a.defaultAlignment;Ya.fb()||(Ya=Ic);var Ta=Ya.x;var Kd=Ya.y;var kc=Ya.offsetX;Ya=Ya.offsetY;var lc=y.alignment,vb=u.alignment;lc.fb()&&(Ta=lc.x,kc=lc.offsetX);vb.fb()&&(Kd=vb.y,Ya=vb.offsetY)}else Ta=Ya.x,Kd=Ya.y,kc=Ya.offsetX,Ya=Ya.offsetY;if(isNaN(Ta)||isNaN(Kd))Kd=Ta=.5,Ya=kc=0;lc=J.width;vb=J.height;var Ld=C.margin,ug=Ld.left+Ld.right,
vg=Ld.top+Ld.bottom,Ve=Jl(C,u,y,!1);!isNaN(C.desiredSize.width)||Ve!==Bd&&Ve!==dl||(lc=Math.max(aa-ug,0));!isNaN(C.desiredSize.height)||Ve!==Bd&&Ve!==el||(vb=Math.max(W-vg,0));aa=C.maxSize;W=C.minSize;lc=Math.min(aa.width,lc);vb=Math.min(aa.height,vb);lc=Math.max(W.width,lc);vb=Math.max(W.height,vb);aa=vb+vg;T+=P*Ta-(lc+ug)*Ta+kc+Ld.left;S+=qa*Kd-aa*Kd+Ya+Ld.top;C.visible&&(jc(ia,Aa,Ma,pb,T,S,J.width,J.height)?C.arrange(T,S,lc,vb):C.arrange(T,S,lc,vb,new M(ia,Aa,Ma,pb)))}else C.ol(),C.actualBounds.ka(),
P=C.actualBounds,T=M.allocAt(P.x,P.y,P.width,P.height),P.x=S.type===X.TableRow?f:h,P.y=S.type===X.TableColumn?e:k,P.width=J.width,P.height=J.height,C.actualBounds.freeze(),rl(C,!1),dc(T,P)||(J=C.part,null!==J&&(J.Rh(),C.Ro(J))),M.free(T)}}}Hb.free(r);for(a=0;a<d;a++)c=b[a],f=c instanceof X?c:null,null===f||f.type!==X.TableRow&&f.type!==X.TableColumn||(f=c.actualBounds,c.naturalBounds.ka(),c.naturalBounds.h(0,0,f.width,f.height),c.naturalBounds.freeze())};function Nm(){this.ta="Base"}ma(Nm,Tl);
Nm.prototype.measure=function(){};Nm.prototype.arrange=function(){};function Om(){this.ta="Base"}ma(Om,Tl);Om.prototype.measure=function(){};Om.prototype.arrange=function(){};function Pm(){this.ta="Base"}ma(Pm,Tl);
Pm.prototype.measure=function(a,b,c,d,e,f,g){1<d.length&&v("Viewbox Panel cannot contain more than one GraphObject.");d=d[0];d.ya=1;d.mk();d.measure(Infinity,Infinity,f,g);var h=d.measuredBounds,k=d.margin,l=k.right+k.left;k=k.top+k.bottom;if(isFinite(b)||isFinite(c)){var m=d.scale,n=h.width;h=h.height;var p=Math.max(b-l,0),r=Math.max(c-k,0),q=1;a.viewboxStretch===rg?0!==n&&0!==h&&(q=Math.min(p/n,r/h)):0!==n&&0!==h&&(q=Math.max(p/n,r/h));0===q&&(q=1E-4);d.ya*=q;m!==d.scale&&(qj(d,!0),d.measure(Infinity,
Infinity,f,g))}h=d.measuredBounds;e.width=isFinite(b)?b:Math.max(h.width+l,0);e.height=isFinite(c)?c:Math.max(h.height+k,0)};Pm.prototype.arrange=function(a,b,c){b=b[0];var d=b.measuredBounds,e=b.margin,f=Math.max(d.width+(e.right+e.left),0);e=Math.max(d.height+(e.top+e.bottom),0);var g=b.alignment;g.Kb()&&(g=a.defaultAlignment);g.fb()||(g=Ic);b.arrange(c.width*g.x-f*g.x+g.offsetX,c.height*g.y-e*g.y+g.offsetY,d.width,d.height)};function Qm(){this.ta="Base"}ma(Qm,Tl);Qm.prototype.measure=function(){};
Qm.prototype.arrange=function(){};
Qm.prototype.uc=function(a,b,c){c=a.Mf()*c.scale;0>=c&&(c=1);var d=a.gridCellSize,e=d.width;d=d.height;var f=a.naturalBounds,g=a.actualBounds,h=f.width,k=f.height,l=Math.ceil(h/e),m=Math.ceil(k/d),n=a.gridOrigin,p=n.x;n=n.y;b.save();b.beginPath();b.rect(0,0,h,k);b.clip();for(var r=[],q=a.W.m,u=q.length,x=0;x<u;x++){var y=q[x],z=[];r.push(z);if(y.visible){var B=y.interval;if(!(0>B)){y=ak(y.figure);for(var D=0;D<u;D++)if(D!==x){var C=q[D];C.visible&&ak(C.figure)===y&&(C=C.interval,C>B&&z.push(C))}}}}q=
a.W.m;u=q.length;for(x=0;x<u;x++){var J=q[x];if(J.visible&&(z=J.interval||1,y=Math.abs(z),!(2>e*y*c))){B=J.segmentIndex;if(!isFinite(B)||isNaN(B))B=0;0>B&&(B=y-Math.min(-B,y));B=Math.round(B%y);y=J.opacity;D=1;if(1!==y){if(0===y)continue;D=b.globalAlpha;b.globalAlpha=D*y}C=r[x];var S=!1,T=J.strokeDashArray;null!==T&&(S=!0,b.As(T,J.strokeDashOffset));if("LineV"===J.figure&&null!==J.stroke&&0<J.strokeWidth){b.lineWidth=J.strokeWidth;pi(a,b,J.stroke,!1,!1,f,g);b.beginPath();for(T=J=Math.floor((p-e)/
e);T<=J+l;T++){var aa=T*e+p;0<=aa&&aa<=h&&Rm(T,z,B,C)&&(b.moveTo(aa,0),b.lineTo(aa,k))}b.stroke()}else if("LineH"===J.figure&&null!==J.stroke&&0<J.strokeWidth){b.lineWidth=J.strokeWidth;pi(a,b,J.stroke,!1,!1,f,g);b.beginPath();for(T=J=Math.floor((n-d)/d);T<=J+m;T++)aa=T*d+n,0<=aa&&aa<=k&&Rm(T,z,B,C)&&(b.moveTo(0,aa),b.lineTo(h,aa));b.stroke()}else if("BarV"===J.figure&&null!==J.fill)for(pi(a,b,J.fill,!0,!1,f,g),J=J.width,isNaN(J)&&(J=e),aa=T=Math.floor((p-e)/e);aa<=T+l;aa++){var W=aa*e+p;0<=W+J&&
W<=h&&Rm(aa,z,B,C)&&b.fillRect(W,0,J,k)}else if("BarH"===J.figure&&null!==J.fill)for(pi(a,b,J.fill,!0,!1,f,g),J=J.height,isNaN(J)&&(J=d),aa=T=Math.floor((n-d)/d);aa<=T+m;aa++)W=aa*d+n,0<=W+J&&W<=k&&Rm(aa,z,B,C)&&b.fillRect(0,W,h,J);S&&b.ys();1!==y&&(b.globalAlpha=D)}}b.restore();b.Oc(!1)};function Rm(a,b,c,d){if(0>b)return a%b===c;if(a%b!==c)return!1;b=d.length;for(var e=0;e<b;e++)if(a%d[e]===c)return!1;return!0}function Sm(){this.ta="Base"}ma(Sm,Tl);
Sm.prototype.measure=function(a,b,c,d,e){c=d.length;if(a instanceof Ke||a instanceof R){var f=null,g=null;a instanceof R&&(f=a);a instanceof Ke&&(g=a,f=g.adornedPart,null===a.j&&(a.j=[]));if(f instanceof R){var h=f;if(0===c)ac(a.naturalBounds,0,0),a.measuredBounds.h(0,0,0,0);else{var k=a instanceof Ke?null:f.path,l=f.routeBounds;b=a.ug;b.h(0,0,l.width,l.height);var m=h.points,n=f.pointsCount;null!==g?g.rk(!1):null!==f&&f.rk(!1);var p=l.width,r=l.height;a.location.h(l.x,l.y);var q=a.j;q.length=0;null!==
k&&(Tm(a,p,r,k),g=k.measuredBounds,b.Xc(g),q.push(g));g=Jb.alloc();for(var u=K.alloc(),x=K.alloc(),y=0;y<c;y++){var z=d[y];if(z!==k)if(z.isPanelMain&&z instanceof Kf){Tm(a,p,r,z);var B=z.measuredBounds;b.Xc(B);q.push(B)}else if(2>n)z.measure(Infinity,Infinity,0,0),B=z.measuredBounds,b.Xc(B),q.push(B);else{var D=z.segmentIndex,C=z.segmentFraction,J=z.alignmentFocus;J.ec()&&(J=Ic);var S=z.segmentOrientation,T=z.segmentOffset;if(isNaN(D)){var aa=h.sa;B=Na();aa.iv(C,B);var W=K.allocAt(B[0],B[1]);W.add(h.i(0));
aa.type===N.j?W.offset(-aa.startX,-aa.startY):(aa=aa.figures.first(),null!==aa&&W.offset(-aa.startX,-aa.startY));aa=B[2];if(S!==dg){var P=h.computeAngle(z,S,aa);z.Eb=P}P=W.x-l.x;var qa=W.y-l.y;K.free(W);Pa(B)}else if(D<-n||D>=n)B=K.alloc(),h.Gg(),h.computeMidPoint(B),aa=h.midAngle,S!==dg&&(P=h.computeAngle(z,S,aa),z.Eb=P),P=B.x-l.x,qa=B.y-l.y,K.free(B);else{P=0;0<=D?(qa=m.M(D),B=D<n-1?m.M(D+1):qa):(P=n+D,qa=m.M(P),B=0<P?m.M(P-1):qa);if(qa.Za(B)){0<=D?(aa=0<D?m.M(D-1):qa,P=D<n-2?m.M(D+2):B):(aa=P<
n-1?m.M(P+1):qa,P=1<P?m.M(P-2):B);W=aa.Jf(qa);var ia=B.Jf(P);aa=W>ia+10?0<=D?aa.Va(qa):qa.Va(aa):ia>W+10?0<=D?B.Va(P):P.Va(B):0<=D?aa.Va(P):P.Va(aa)}else aa=0<=D?qa.Va(B):B.Va(qa);S!==dg&&(P=h.computeAngle(z,S,aa),z.Eb=P);P=qa.x+(B.x-qa.x)*C-l.x;qa=qa.y+(B.y-qa.y)*C-l.y}z.measure(Infinity,Infinity,0,0);B=z.measuredBounds;W=z.naturalBounds;var Aa=0;z instanceof Kf&&(Aa=z.strokeWidth);ia=W.width+Aa;var Ma=W.height+Aa;g.reset();g.translate(-B.x,-B.y);g.scale(z.scale,z.scale);g.rotate(S===dg?z.angle:
aa,ia/2,Ma/2);S!==Um&&S!==Vm||g.rotate(90,ia/2,Ma/2);S!==Wm&&S!==Xm||g.rotate(-90,ia/2,Ma/2);S===Ym&&(45<aa&&135>aa||225<aa&&315>aa)&&g.rotate(-aa,ia/2,Ma/2);W=new M(0,0,ia,Ma);u.ej(W,J);g.Ga(u);J=-u.x+Aa/2*z.scale;z=-u.y+Aa/2*z.scale;x.assign(T);Aa=isNaN(T.x);var pb=isNaN(T.y);if(Aa||pb){ia=ia/2+3;Ma=Ma/2+3;var Ya=45<=aa&&135>=aa,Ta=225<=aa&&315>=aa;S===dg&&(Ya||Ta)?(x.x=pb?ia:T.y,x.y=Aa?Ma:T.x,Ya?0<=D||isNaN(D)&&.5>C||!Aa||(x.y=-Ma):Ta&&((0<=D||isNaN(D)&&.5>C)&&Aa&&(x.y=-Ma),pb&&(x.x=-ia))):(Aa&&
(x.x=0<=D||isNaN(D)&&.5>C?ia:-ia),pb&&(x.y=-Ma),x.rotate(aa))}else x.rotate(aa);P+=x.x;qa+=x.y;W.set(B);W.h(P+J,qa+z,B.width,B.height);q.push(W);b.Xc(W)}}if(null!==f)for(d=f.labelNodes;d.next();)d.value.measure(Infinity,Infinity);a.ug=b;a=a.location;a.h(a.x+b.x,a.y+b.y);ac(e,b.width||0,b.height||0);Jb.free(g);K.free(u);K.free(x)}}}};
Sm.prototype.arrange=function(a,b){var c=b.length;if(a instanceof Ke||a instanceof R){var d=a,e=null;a instanceof Ke&&(e=a,d=e.adornedPart);var f=a instanceof Ke?null:d.path,g=a.j;if(0!==g.length){var h=0;if(null!==f&&h<g.length){var k=g[h];h++;f.arrange(k.x-a.ug.x,k.y-a.ug.y,k.width,k.height)}for(k=0;k<c;k++){var l=b[k];if(l!==f&&h<g.length){var m=g[h];h++;l.arrange(m.x-a.ug.x,m.y-a.ug.y,m.width,m.height)}}}b=d.points;c=b.count;if(2<=c&&a instanceof R)for(f=a.labelNodes;f.next();){var n=a;g=f.value;
h=g.segmentIndex;k=g.segmentFraction;var p=g.alignmentFocus;l=g.segmentOrientation;m=g.segmentOffset;if(isNaN(h)){var r=n.sa;var q=Na();r.iv(k,q);var u=K.allocAt(q[0],q[1]);u.add(n.i(0));r.type===N.j?u.offset(-r.startX,-r.startY):(r=r.figures.first(),u.offset(-r.startX,-r.startY));r=q[2];l!==dg&&(n=n.computeAngle(g,l,r),g.angle=n);n=u.x;var x=u.y;K.free(u);Pa(q)}else if(h<-c||h>=c)q=K.alloc(),r=n,x=q,r.Gg(),r.computeMidPoint(x),r=n.midAngle,l!==dg&&(n=n.computeAngle(g,l,r),g.angle=n),n=q.x,x=q.y,
K.free(q);else{u=0;0<=h?(q=b.m[h],x=h<c-1?b.m[h+1]:q):(u=c+h,q=b.m[u],x=0<u?b.m[u-1]:q);if(q.Za(x)){0<=h?(r=0<h?b.m[h-1]:q,u=h<c-2?b.m[h+2]:x):(r=u<c-1?b.m[u+1]:q,u=1<u?b.m[u-2]:x);var y=r.Jf(q),z=x.Jf(u);r=y>z+10?0<=h?r.Va(q):q.Va(r):z>y+10?0<=h?x.Va(u):u.Va(x):0<=h?r.Va(u):u.Va(r)}else r=0<=h?q.Va(x):x.Va(q);l!==dg&&(n=n.computeAngle(g,l,r),g.angle=n);n=q.x+(x.x-q.x)*k;x=q.y+(x.y-q.y)*k}if(p.sq())g.location=new K(n,x);else{p.ec()&&(p=Ic);q=Jb.alloc();q.reset();q.scale(g.scale,g.scale);q.rotate(g.angle,
0,0);var B=g.naturalBounds;u=M.allocAt(0,0,B.width,B.height);y=K.alloc();y.ej(u,p);q.Ga(y);p=-y.x;z=-y.y;var D=B.width,C=B.height;B=K.alloc();B.assign(m);var J=isNaN(m.x),S=isNaN(m.y);if(J||S){D=D/2+3;C=C/2+3;var T=45<=r&&135>=r,aa=225<=r&&315>=r;l===dg&&(T||aa)?(B.x=S?D:m.y,B.y=J?C:m.x,T?0<=h||isNaN(h)&&.5>k||!J||(B.y=-C):aa&&((0<=h||isNaN(h)&&.5>k)&&J&&(B.y=-C),S&&(B.x=-D))):(J&&(B.x=0<=h||isNaN(h)&&.5>k?D:-D),S&&(B.y=-C),B.rotate(r))}else B.rotate(r);n+=B.x;x+=B.y;q.Kq(u);p+=u.x;z+=u.y;h=K.allocAt(n+
p,x+z);g.move(h);K.free(h);K.free(B);K.free(y);M.free(u);Jb.free(q)}}null!==e?e.rk(!1):d.rk(!1)}};
function Tm(a,b,c,d){if(!1!==vj(d)){var e=d.strokeWidth;0===e&&a instanceof Ke&&a.type===X.Link&&a.adornedObject instanceof Kf&&(e=a.adornedObject.strokeWidth);e*=d.ya;a instanceof R&&null!==a.sa?(a=a.sa.bounds,d.Ie(a.x-e/2,a.y-e/2,a.width+e,a.height+e)):a instanceof Ke&&null!==a.adornedPart.sa?(a=a.adornedPart.sa.bounds,d.Ie(a.x-e/2,a.y-e/2,a.width+e,a.height+e)):d.Ie(-(e/2),-(e/2),b+e,c+e);qj(d,!1)}}function Zm(){this.ta="Base"}ma(Zm,Tl);
Zm.prototype.measure=function(a,b,c,d,e,f,g){var h=a.ub();a.ah=[];var k=h.margin,l=k.right+k.left,m=k.top+k.bottom;h.measure(b,c,f,g);var n=h.measuredBounds,p=new M(-k.left,-k.top,Math.max(n.width+l,0),Math.max(n.height+m,0));a.ah.push(p);e.assign(p);for(var r=h.geometry,q=h.strokeWidth,u=r.flattenedSegments,x=r.flattenedLengths,y=r.flattenedTotalLength,z=u.length,B=0,D=0,C=Na(),J=0;J<z;J++){var S=u[J],T=[];D=B=0;for(var aa=S.length,W=0;W<aa;W+=2){var P=S[W],qa=S[W+1];if(0!==W){var ia=180*Math.atan2(qa-
D,P-B)/Math.PI;0>ia&&(ia+=360);T.push(ia)}B=P;D=qa}C.push(T)}if(null===a.cg){for(var Aa=[],Ma=a.W.m,pb=Ma.length,Ya=0;Ya<pb;Ya++){var Ta=Ma[Ya],Kd=[];Aa.push(Kd);if(Ta.visible){var kc=Ta.interval;if(!(0>kc))for(var lc=0;lc<pb;lc++)if(lc!==Ya){var vb=Ma[lc];if(vb.visible&&Ta.constructor===vb.constructor){var Ld=vb.interval;Ld>kc&&Kd.push(Ld)}}}}a.cg=Aa}var ug=a.cg;var vg=a.W.m,Ve=vg.length,Sb=0,Eh=0,wg=y;a.uj=[];for(var Fh,Gh=0;Gh<Ve;Gh++){var sb=vg[Gh];Fh=[];if(sb.visible&&sb!==h){var Oi=Math.abs(sb.interval),
ok=a.graduatedTickUnit;if(!(2>ok*Oi*y/a.graduatedRange)){var xg=x[0][0],xd=0,xc=0;Eh=y*sb.graduatedStart-1E-4;wg=y*sb.graduatedEnd+1E-4;var Qf=ok*Oi,Ec=a.graduatedTickBase;if(Ec<a.graduatedMin){var yg=(a.graduatedMin-Ec)/Qf;yg=0===yg%1?yg:Math.floor(yg+1);Ec+=yg*Qf}else Ec>a.graduatedMin+Qf&&(Ec-=Math.floor((Ec-a.graduatedMin)/Qf)*Qf);for(var Hh=ug[Gh],Ln=Ec,Ud=1;Ec<a.graduatedMax+5E-8;Ud++){a:{for(var Ae=Hh.length,zg=0;zg<Ae;zg++)if(L.da((Ec-a.graduatedTickBase)%(Hh[zg]*a.graduatedTickUnit),0)){var qf=
!1;break a}qf=!0}if(qf&&(null===sb.graduatedSkip||!sb.graduatedSkip(Ec))&&(Sb=(Ec-a.graduatedMin)*y/a.graduatedRange,Sb>y&&(Sb=y),Eh<=Sb&&Sb<=wg)){for(var gd=C[xd][xc],Md=x[xd][xc];xd<x.length;){for(;Sb>xg&&xc<x[xd].length-1;)xc++,gd=C[xd][xc],Md=x[xd][xc],xg+=Md;if(Sb<=xg)break;xd++;xc=0;gd=C[xd][xc];Md=x[xd][xc];xg+=Md}var qc=u[xd],Ih=qc[2*xc],Jh=qc[2*xc+1],hd=(Sb-(xg-Md))/Md,Pi=new K(Ih+(qc[2*xc+2]-Ih)*hd+q/2-r.bounds.x,Jh+(qc[2*xc+3]-Jh)*hd+q/2-r.bounds.y);Pi.scale(h.scale,h.scale);var Be=gd,
rf=C[xd];1E-4>hd?0<xc?Be=rf[xc-1]:L.da(qc[0],qc[qc.length-2])&&L.da(qc[1],qc[qc.length-1])&&(Be=rf[rf.length-1]):.9999<hd&&(xc+1<rf.length?Be=rf[xc+1]:L.da(qc[0],qc[qc.length-2])&&L.da(qc[1],qc[qc.length-1])&&(Be=rf[0]));gd!==Be&&(180<Math.abs(gd-Be)&&(gd<Be?gd+=360:Be+=360),gd=(gd+Be)/2%360);if(sb instanceof Yg){var Nd="";null!==sb.graduatedFunction?(Nd=sb.graduatedFunction(Ec),Nd=null!==Nd&&void 0!==Nd?Nd.toString():""):Nd=(+Ec.toFixed(2)).toString();""!==Nd&&Fh.push({xm:Pi,angle:gd,text:Nd})}else Fh.push({xm:Pi,
angle:gd})}Ec=Ln+Ud*Qf}}}a.uj.push(Fh)}Pa(C);var pk=a.uj;if(null!==pk)for(var Mn=d.length,Rf=0;Rf<Mn;Rf++){var Tb=d[Rf],Vd=pk[Rf];if(Tb.visible&&Tb!==h&&0!==Vd.length){if(Tb instanceof Kf){var wb=a,Qi=e,mc=Tb.alignmentFocus;mc.ec()&&(mc=Dc);var Fc=Tb.angle;Tb.Eb=0;Tb.measure(Infinity,Infinity,0,0);Tb.Eb=Fc;var yc=Tb.measuredBounds,Wd=yc.width,Xd=yc.height,Ag=M.allocAt(0,0,Wd,Xd),Mc=K.alloc();Mc.ej(Ag,mc);M.free(Ag);for(var Kh=-Mc.x,Bg=-Mc.y,Yd=new M,Lh=Vd.length,sf=0;sf<Lh;sf++)for(var Zd=Vd[sf],
$d=Zd.xm.x,ae=Zd.xm.y,We=Zd.angle,Mh=0;4>Mh;Mh++){switch(Mh){case 0:Mc.h(Kh,Bg);break;case 1:Mc.h(Kh+Wd,Bg);break;case 2:Mc.h(Kh,Bg+Xd);break;case 3:Mc.h(Kh+Wd,Bg+Xd)}Mc.rotate(We+Tb.angle);Mc.offset($d,ae);0===sf&&0===Mh?Yd.h(Mc.x,Mc.y,0,0):Yd.af(Mc);Mc.offset(-$d,-ae);Mc.rotate(-We-Tb.angle)}K.free(Mc);null!==wb.ah&&wb.ah.push(Yd);ic(Qi,Yd.x,Yd.y,Yd.width,Yd.height)}else if(Tb instanceof Yg){var Ce=a,Nn=e;null===Ce.Bh&&(Ce.Bh=new Yg);var rc=Ce.Bh;$m(rc,Tb);var bb=Tb.alignmentFocus;bb.ec()&&(bb=
Dc);for(var sc=Tb.segmentOrientation,be=Tb.segmentOffset,Xe=new M,Nh=0,Ye=0,Yc=0,tf=0,Oh=0,On=Vd.length,Cg=0;Cg<On;Cg++){var yd=Vd[Cg];Nh=yd.xm.x;Ye=yd.xm.y;Yc=yd.angle;Oh=tf=Tb.angle;sc!==dg&&(Oh=sc===an||sc===bn?Yc+Tb.angle:Yc,tf=R.computeAngle(sc,Oh));rc.Eb=tf;rc.text=yd.text||"";rc.measure(Infinity,Infinity,0,0);var ce=rc.measuredBounds,De=rc.naturalBounds,Ee=De.width,de=De.height,Fe=Jb.alloc();Fe.reset();Fe.translate(-ce.x,-ce.y);Fe.scale(rc.scale,rc.scale);Fe.rotate(Oh,Ee/2,de/2);sc!==Um&&sc!==
Vm||Fe.rotate(90,Ee/2,de/2);sc!==Wm&&sc!==Xm||Fe.rotate(-90,Ee/2,de/2);sc===Ym&&(45<Yc&&135>Yc||225<Yc&&315>Yc)&&Fe.rotate(-Yc,Ee/2,de/2);var qk=M.allocAt(0,0,Ee,de),Ze=K.alloc();Ze.ej(qk,bb);Fe.Ga(Ze);var Ri=-Ze.x,Si=-Ze.y,zd=K.alloc();zd.assign(be);isNaN(zd.x)&&(zd.x=Ee/2+3);isNaN(zd.y)&&(zd.y=-(de/2+3));zd.rotate(Yc);Nh+=zd.x+Ri;Ye+=zd.y+Si;var Sf=new M(Nh,Ye,ce.width,ce.height),Ph=new M(ce.x,ce.y,ce.width,ce.height),Dg=new M(De.x,De.y,De.width,De.height);yd.IA=tf;yd.lineCount=rc.lineCount;yd.lines=
[rc.xb,rc.pi,rc.Be,rc.Ne,rc.Jc,rc.Xb,rc.ze];yd.actualBounds=Sf;yd.measuredBounds=Ph;yd.naturalBounds=Dg;0===Cg?Xe.assign(Sf):Xe.Xc(Sf);K.free(zd);K.free(Ze);M.free(qk);Jb.free(Fe)}null!==Ce.ah&&Ce.ah.push(Xe);ic(Nn,Xe.x,Xe.y,Xe.width,Xe.height)}qj(Tb,!1)}}};
Zm.prototype.arrange=function(a,b,c){if(null!==a.ah){var d=a.ub(),e=a.uj;if(null!==e){var f=a.ah,g=0,h=f[g];g++;null!==d&&d.arrange(h.x-c.x,h.y-c.y,h.width,h.height);for(var k=b.length,l=0;l<k;l++){var m=b[l];h=e[l];m.visible&&m!==d&&0!==h.length&&(h=f[g],g++,m.arrange(h.x-c.x,h.y-c.y,h.width,h.height))}a.ah=null}}};
Zm.prototype.uc=function(a,b,c){var d=c.zj;c.zj=!0;var e=a.naturalBounds,f=e.width;e=e.height;b.save();b.beginPath();b.rect(-1,-1,f+1,e+1);b.clip();f=a.ub();f.uc(b,c);e=a.Mf()*c.scale;0>=e&&(e=1);for(var g=f.actualBounds,h=a.W.m,k=a.uj,l=h.length,m=0;m<l;m++){var n=h[m],p=k[m],r=p.length;if(n.visible&&n!==f&&0!==p.length)if(n instanceof Kf){if(!(2>a.graduatedTickUnit*n.interval*f.geometry.flattenedTotalLength/a.graduatedRange*e)){var q=n.measuredBounds,u=n.strokeWidth*n.scale,x=n.alignmentFocus;x.ec()&&
(x=Dc);for(var y=0;y<r;y++){var z=p[y].xm,B=p[y].angle,D=x,C=n.Ab;C.reset();C.translate(z.x+g.x,z.y+g.y);C.rotate(B+n.angle,0,0);C.translate(-q.width*D.x+D.offsetX+u/2,-q.height*D.y+D.offsetY+u/2);C.scale(n.scale,n.scale);Gl(n,!1);n.Yh.set(n.Ab);n.cl=n.scale;Hl(n,!1);n.uc(b,c);n.Ab.reset()}}}else if(n instanceof Yg)for(null===a.Bh&&(a.Bh=new Yg),q=a.Bh,$m(q,n),n=0;n<r;n++)u=p[n],u.actualBounds&&u.measuredBounds&&u.naturalBounds&&(q.bc=u.text||"",q.Eb=u.IA||0,q.dd=u.lineCount||0,x=u.lines,void 0!==
x&&(q.xb=x[0],q.pi=x[1],q.Be=x[2],q.Ne=x[3],q.Jc=x[4],q.Xb=x[5],q.ze=x[6]),u.naturalBounds&&(q.Ac=u.naturalBounds),u.actualBounds&&(x=u.actualBounds,q.arrange(x.x,x.y,x.width,x.height)),x=u.actualBounds,q.arrange(x.x,x.y,x.width,x.height),y=u.measuredBounds,u=u.naturalBounds,z=q.Ab,z.reset(),z.translate(x.x+g.x,x.y+g.y),z.translate(-y.x,-y.y),q.Ap(z,u.x,u.y,u.width,u.height),Gl(q,!1),q.Yh.set(q.Ab),q.cl=q.scale,Hl(q,!1),q.uc(b,c))}c.zj=d;b.restore();b.Oc(!0)};
function X(a,b){O.call(this);this.na=null;if(void 0===a)this.na=X.Position;else if("string"===typeof a){var c=Sl.K(a);null!==c&&(this.na=c)}else a instanceof Tl?this.na=a:a&&(this.na=X.Position,b=a);null===this.na&&v("Panel type not specified or PanelLayout not loaded: "+a);this.W=new H;this.sb=zc;this.na===X.Grid&&(this.H|=1048576);this.yn=dd;this.$f=cl;this.na===X.Table&&cn(this);this.Tp=rg;this.Wn=Vb;this.Xn=zb;this.Tn=0;this.Sn=100;this.Vn=10;this.Un=0;this.ai=this.ob=this.cg=this.ah=this.uj=
null;this.po=NaN;this.Fe=this.ni=null;this.sl="category";this.fe=null;this.ug=new M(NaN,NaN,NaN,NaN);this.Bh=this.qp=this.Ah=null;this.cf="";b&&Object.assign(this,b)}ma(X,O);function cn(a){a.pj=zc;a.Sg=1;a.gi=null;a.fi=null;a.Rg=1;a.Qg=null;a.ei=null;a.tb=[];a.nb=[];a.Pj=dn;a.oj=dn;a.Gi=0;a.si=0}
X.prototype.cloneProtected=function(a){O.prototype.cloneProtected.call(this,a);a.na=this.na;a.sb=this.sb.L();a.yn=this.yn.L();a.$f=this.$f;if(a.na===X.Table){a.pj=this.pj.L();a.Sg=this.Sg;a.gi=this.gi;a.fi=this.fi;a.Rg=this.Rg;a.Qg=this.Qg;a.ei=this.ei;var b=[];if(0<this.tb.length)for(var c=this.tb,d=c.length,e=0;e<d;e++)if(void 0!==c[e]){var f=c[e].copy();f.dj(a);b[e]=f}a.tb=b;b=[];if(0<this.nb.length)for(c=this.nb,d=c.length,e=0;e<d;e++)void 0!==c[e]&&(f=c[e].copy(),f.dj(a),b[e]=f);a.nb=b;a.Pj=
this.Pj;a.oj=this.oj;a.Gi=this.Gi;a.si=this.si}a.Tp=this.Tp;a.Wn=this.Wn.L();a.Xn=this.Xn.L();a.Tn=this.Tn;a.Sn=this.Sn;a.Vn=this.Vn;a.Un=this.Un;a.uj=this.uj;a.cg=this.cg;a.ob=this.ob;a.ai=this.ai;a.po=this.po;a.ni=this.ni;a.Fe=this.Fe;a.sl=this.sl;a.ug.assign(this.ug);a.cf=this.cf;null!==this.qp&&(a.qp=this.qp)};X.prototype.If=function(a){O.prototype.If.call(this,a);a.W=this.W;for(var b=a.W.m,c=b.length,d=0;d<c;d++)b[d].ng=a;a.Ah=null};
X.prototype.copy=function(){var a=O.prototype.copy.call(this);if(null!==a){for(var b=this.W.m,c=b.length,d=0;d<c;d++){var e=b[d].copy();e.dj(a);e.Nj=null;var f=a.W,g=f.count;f.Bb(g,e);f=a.part;if(null!==f){f.xi=null;null!==e.portId&&f instanceof V&&(f.We=!0);var h=a.diagram;null!==h&&h.undoManager.isUndoingRedoing||f.bb(ue,"elements",a,null,e,null,g)}}return a}return null};t=X.prototype;t.toString=function(){return"Panel("+this.type.name+")#"+lb(this)};
t.Ro=function(a){O.prototype.Ro.call(this,a);for(var b=this.W.m,c=b.length,d=0;d<c;d++)b[d].Ro(a)};
t.Pi=function(a,b){if(this.na===X.Grid)a.Ld(),this.na.uc(this,a,b);else if(this.na===X.Graduated)a.Ld(),this.na.uc(this,a,b);else{this.na===X.Table&&(a.Ld(),a.lineCap="butt",en(this,a,!0,this.tb,!0),en(this,a,!1,this.nb,!0),fn(this,a,!0,this.tb),fn(this,a,!1,this.nb),en(this,a,!0,this.tb,!1),en(this,a,!1,this.nb,!1));var c=this.isClipping&&this.na===X.Spot;c&&a.save();for(var d=this.ub(),e=this.W.m,f=e.length,g=0;g<f;g++){var h=e[g];c&&h===d&&(a.clipInsteadOfFill=!0);h.uc(a,b);c&&h===d&&(a.clipInsteadOfFill=
!1)}c&&(a.restore(),a.Oc(!0))}};
function fn(a,b,c,d){for(var e=d.length,f=a.actualBounds,g=a.naturalBounds,h=!0,k=0;k<e;k++){var l=d[k];if(void 0!==l)if(h)h=!1;else if(0!==l.actual){if(c){if(l.position>f.height)continue}else if(l.position>f.width)continue;var m=l.separatorStrokeWidth;isNaN(m)&&(m=c?a.Sg:a.Rg);var n=l.separatorStroke;null===n&&(n=c?a.gi:a.Qg);if(0!==m&&null!==n){pi(a,b,n,!1,!1,g,f);n=!1;var p=l.separatorDashArray;null===p&&(p=c?a.fi:a.ei);null!==p&&(n=!0,b.As(p,0));b.beginPath();p=l.position+m;c?p>f.height&&(m-=
p-f.height):p>f.width&&(m-=p-f.width);l=l.position+m/2;b.lineWidth=m;m=a.sb;c?(l+=m.top,p=f.width-m.right,b.moveTo(m.left,l),b.lineTo(p,l)):(l+=m.left,p=f.height-m.bottom,b.moveTo(l,m.top),b.lineTo(l,p));b.stroke();n&&b.ys()}}}}
function en(a,b,c,d,e){for(var f=d.length,g=a.actualBounds,h=a.naturalBounds,k=0;k<f;k++){var l=d[k];if(void 0!==l&&null!==l.background&&l.coversSeparators!==e&&0!==l.actual){var m=c?g.height:g.width;if(!(l.position>m)){var n=l.Pc(),p=l.separatorStrokeWidth;isNaN(p)&&(p=c?a.Sg:a.Rg);var r=l.separatorStroke;null===r&&(r=c?a.gi:a.Qg);null===r&&(p=0);n-=p;p=l.position+p;n+=l.actual;p+n>m&&(n=m-p);0>=n||(m=a.sb,pi(a,b,l.background,!0,!1,h,g),c?b.fillRect(m.left,p+m.top,g.width-(m.left+m.right),n):b.fillRect(p+
m.left,m.top,n,g.height-(m.top+m.bottom)))}}}}function ak(a){return"LineV"===a||"BarV"===a}
t.kk=function(a,b,c,d,e){var f=this.re(),g=this.transform,h=1/(g.m11*g.m22-g.m12*g.m21),k=g.m22*h,l=-g.m12*h,m=-g.m21*h,n=g.m11*h,p=h*(g.m21*g.dy-g.m22*g.dx),r=h*(g.m12*g.dx-g.m11*g.dy);if(null!==this.areaBackground)return g=this.actualBounds,L.Of(g.left,g.top,g.right,g.bottom,a,b,c,d,e);if(null!==this.background)return f=a*k+b*m+p,h=a*l+b*n+r,a=c*k+d*m+p,k=c*l+d*n+r,e.h(0,0),c=this.naturalBounds,f=L.Of(0,0,c.width,c.height,f,h,a,k,e),e.transform(g),f;f||(k=1,m=l=0,n=1,r=p=0);h=a*k+b*m+p;a=a*l+b*
n+r;k=c*k+d*m+p;c=c*l+d*n+r;e.h(k,c);d=(k-h)*(k-h)+(c-a)*(c-a);l=!1;n=this.W.m;r=n.length;m=K.alloc();p=null;b=Infinity;var q=null,u=this.isClipping&&this.na===X.Spot;u&&(q=K.alloc(),p=this.ub(),(l=p.kk(h,a,k,c,q))&&(b=(h-q.x)*(h-q.x)+(a-q.y)*(a-q.y)));for(var x=0;x<r;x++){var y=n[x];y.visible&&y!==p&&y.kk(h,a,k,c,m)&&(l=!0,y=(h-m.x)*(h-m.x)+(a-m.y)*(a-m.y),y<d&&(d=y,e.set(m)))}u&&(b>d&&e.set(q),K.free(q));K.free(m);f&&e.transform(g);return l};
t.v=function(a){if(!vj(this)){O.prototype.v.call(this,a);a=null;if(this.na===X.Auto||this.na===X.Link)a=this.ub();for(var b=this.W.m,c=b.length,d=0;d<c;d++){var e=b[d];(e===a||e.isPanelMain)&&e.v(!0);if(!e.desiredSize.s()){var f=ql(e,!1);(e instanceof ng||e instanceof X||e instanceof Yg||f!==pg)&&e.v(!0)}}}};t.mk=function(){if(!vj(this)){qj(this,!0);rl(this,!0);for(var a=this.W.m,b=a.length,c=0;c<b;c++)a[c].mk()}};
t.ol=function(){if(0!==(this.H&2048)===!1){Gl(this,!0);Hl(this,!0);for(var a=this.W.m,b=a.length,c=0;c<b;c++)a[c].qv()}};t.qv=function(){Hl(this,!0);for(var a=this.W.m,b=a.length,c=0;c<b;c++)a[c].qv()};
t.um=function(a,b,c,d){var e=this.ug;e.h(0,0,0,0);var f=this.desiredSize,g=this.minSize;void 0===c&&(c=g.width,d=g.height);c=Math.max(c,g.width);d=Math.max(d,g.height);var h=this.maxSize;isNaN(f.width)||(a=Math.min(f.width,h.width));isNaN(f.height)||(b=Math.min(f.height,h.height));a=Math.max(c,a);b=Math.max(d,b);var k=this.sb;a=Math.max(a-k.left-k.right,0);b=Math.max(b-k.top-k.bottom,0);var l=this.W.m;0!==l.length&&this.na.measure(this,a,b,l,e,c,d);a=e.width+k.left+k.right;k=e.height+k.top+k.bottom;
isFinite(f.width)&&(a=f.width);isFinite(f.height)&&(k=f.height);a=Math.min(h.width,a);k=Math.min(h.height,k);a=Math.max(g.width,a);k=Math.max(g.height,k);a=Math.max(c,a);k=Math.max(d,k);ac(e,a,k);ac(this.naturalBounds,a,k);this.Ie(0,0,a,k)};t.ub=function(){if(null===this.Ah){var a=this.W.m,b=a.length;if(0===b)return null;for(var c=0;c<b;c++){var d=a[c];if(!0===d.isPanelMain)return this.Ah=d}this.Ah=a[0]}return this.Ah};function Cm(a){return null!==a.part?a.part.locationObject:null}
t.Kh=function(a,b,c,d){var e=this.W.m;this.actualBounds.h(a,b,c,d);if(0!==e.length){if(!this.desiredSize.s()){a=ql(this,!0);var f=this.measuredBounds;b=f.width;f=f.height;var g=this.gh,h=g.left+g.right;g=g.top+g.bottom;b===c&&f===d&&(a=pg);switch(a){case pg:if(b>c||f>d)this.v(),this.measure(b>c?c:b,f>d?d:f,0,0);break;case Bd:this.v(!0);this.measure(c+h,d+g,0,0);break;case dl:this.v(!0);this.measure(c+h,f+g,0,0);break;case el:this.v(!0),this.measure(b+h,d+g,0,0)}}this.na.arrange(this,e,this.ug)}};
t.Mh=function(a){var b=this.naturalBounds,c=Cm(this);if(jc(0,0,b.width,b.height,a.x,a.y)){b=this.W.m;for(var d=b.length,e=K.allocAt(0,0);d--;){var f=b[d];if(f.visible||f===c)if(Kb(e.set(a),f.transform),f.ca(e))return K.free(e),!0}K.free(e);return null===this.Zb&&null===this.pd?!1:!0}return!1};t.Bs=function(a){if(this.Ok===a)return this;for(var b=this.W.m,c=b.length,d=0;d<c;d++){var e=b[d].Bs(a);if(null!==e)return e}return null};
t.Bk=function(a,b){b(this,a);if(a instanceof X){a=a.W.m;for(var c=a.length,d=0;d<c;d++)this.Bk(a[d],b)}};function Ij(a,b){gn(a,a,b)}function gn(a,b,c){c(b);b=b.W.m;for(var d=b.length,e=0;e<d;e++){var f=b[e];f instanceof X&&gn(a,f,c)}}function hn(a,b){jn(a,a,b)}function jn(a,b,c){c(b);if(b instanceof X){b=b.W.m;for(var d=b.length,e=0;e<d;e++)jn(a,b[e],c)}}t.lm=function(a){return kn(this,this,a)};
function kn(a,b,c){if(c(b))return b;if(b instanceof X){b=b.W.m;for(var d=b.length,e=0;e<d;e++){var f=kn(a,b[e],c);if(null!==f)return f}}return null}t.eb=function(a){if(this.name===a)return this;var b=this.W.m,c=b.length;null===this.ni&&null===this.Fe||(c=ln(this));for(var d=0;d<c;d++){var e=b[d];if(e instanceof X){var f=e.eb(a);if(null!==f)return f}if(e.name===a)return e}return null};
function mn(a){a=a.W.m;for(var b=a.length,c=0,d=0;d<b;d++){var e=a[d];e instanceof X?c=Math.max(c,mn(e)):e instanceof Kf&&(c=Math.max(c,e.tg/2*e.Uj*e.Mf()))}return c}t.re=function(){return!(this.type===X.TableRow||this.type===X.TableColumn)};
t.dc=function(a,b,c){if(!1===this.pickable)return null;void 0===b&&(b=null);void 0===c&&(c=null);if(wj(this))return null;var d=this.naturalBounds,e=1/this.Mf(),f=this.re(),g=f?a:Kb(K.allocAt(a.x,a.y),this.transform),h=this.diagram,k=10,l=5;null!==h&&(k=h.om("extraTouchArea"),l=k/2);if(jc(-(l*e),-(l*e),d.width+k*e,d.height+k*e,g.x,g.y)){if(!this.isAtomic){e=this.W.m;var m=e.length;h=K.alloc();l=(k=this.isClipping&&this.na===X.Spot)?this.ub():null;if(k&&(l.re()?Kb(h.set(a),l.transform):h.set(a),!l.ca(h)))return K.free(h),
f||K.free(g),null;for(var n=Cm(this);m--;){var p=e[m];if(p.visible||p===n)if(p.re()?Kb(h.set(a),p.transform):h.set(a),!k||p!==l){var r=null;p instanceof X?r=p.dc(h,b,c):!0===p.pickable&&p.ca(h)&&(r=p);if(null!==r&&(null!==b&&(r=b(r)),null!==r&&(null===c||c(r))))return K.free(h),f||K.free(g),r}}K.free(h)}if(null===this.background&&null===this.areaBackground)return f||K.free(g),null;a=jc(0,0,d.width,d.height,g.x,g.y)?this:null;f||K.free(g);return a}f||K.free(g);return null};
t.Si=function(a,b,c,d){if(!1===this.pickable)return!1;void 0===b&&(b=null);void 0===c&&(c=null);var e=this.naturalBounds,f=this.re(),g=f?a:Kb(K.allocAt(a.x,a.y),this.transform),h=this.type===X.TableRow||this.type===X.TableColumn;e=jc(0,0,e.width,e.height,g.x,g.y);if(h||e){if(!this.isAtomic){h=this.W.m;for(var k=h.length,l=K.alloc(),m=Cm(this);k--;){var n=h[k];if(n.visible||n===m){n.re()?Kb(l.set(a),n.transform):l.set(a);var p=n;n=n instanceof X?n:null;(null!==n?n.Si(l,b,c,d):p.ca(l))&&!1!==p.pickable&&
(null!==b&&(p=b(p)),null===p||null!==c&&!c(p)||d.add(p))}}K.free(l)}f||K.free(g);return e&&(null!==this.background||null!==this.areaBackground)}f||K.free(g);return!1};
t.Lf=function(a,b,c,d,e,f){if(!1===this.pickable)return!1;void 0===b&&(b=null);void 0===c&&(c=null);var g=f;void 0===f&&(g=Jb.alloc(),g.reset());g.multiply(this.transform);if(this.Lh(a,g))return nn(this,b,c,e),void 0===f&&Jb.free(g),!0;if(this.Sc(a,g)){if(!this.isAtomic)for(var h=Cm(this),k=this.W.m,l=k.length;l--;){var m=k[l];if(m.visible||m===h){var n=m.actualBounds,p=this.naturalBounds;if(!(n.x>p.width||n.y>p.height||0>n.x+n.width||0>n.y+n.height)){n=m;m=m instanceof X?m:null;p=Jb.alloc();p.set(g);
if(null!==m?m.Lf(a,b,c,d,e,p):pl(n,a,d,p))null!==b&&(n=b(n)),null===n||null!==c&&!c(n)||e.add(n);Jb.free(p)}}}void 0===f&&Jb.free(g);return d}void 0===f&&Jb.free(g);return!1};function nn(a,b,c,d){for(var e=a.W.m,f=e.length;f--;){var g=e[f];if(g.visible){var h=g.actualBounds,k=a.naturalBounds;h.x>k.width||h.y>k.height||0>h.x+h.width||0>h.y+h.height||(g instanceof X&&nn(g,b,c,d),null!==b&&(g=b(g)),null===g||null!==c&&!c(g)||d.add(g))}}}
t.Bg=function(a,b,c,d,e,f){if(!1===this.pickable)return!1;void 0===c&&(c=null);void 0===d&&(d=null);var g=this.naturalBounds,h=this.re(),k=h?a:Kb(K.allocAt(a.x,a.y),this.transform),l=h?b:Kb(K.allocAt(b.x,b.y),this.transform),m=k.Jf(l),n=0<k.x&&k.x<g.width&&0<k.y&&k.y<g.height||Lb(k.x,k.y,0,0,0,g.height)<=m||Lb(k.x,k.y,0,g.height,g.width,g.height)<=m||Lb(k.x,k.y,g.width,g.height,g.width,0)<=m||Lb(k.x,k.y,g.width,0,0,0)<=m;g=k.wd(0,0)<=m&&k.wd(0,g.height)<=m&&k.wd(g.width,0)<=m&&k.wd(g.width,g.height)<=
m;h||(K.free(k),K.free(l));if(n){if(!this.isAtomic){k=K.alloc();l=K.alloc();m=Cm(this);for(var p=this.W.m,r=p.length;r--;){var q=p[r];if(q.visible||q===m){var u=q.actualBounds,x=this.naturalBounds;if(!h||!(u.x>x.width||u.y>x.height||0>u.x+u.width||0>u.y+u.height))if(q.re()?(u=q.transform,Kb(k.set(a),u),Kb(l.set(b),u)):(k.set(a),l.set(b)),u=q,q=q instanceof X?q:null,null!==q?q.Bg(k,l,c,d,e,f):u.ey(k,l,e))null!==c&&(u=c(u)),null===u||null!==d&&!d(u)||f.add(u)}}K.free(k);K.free(l)}return e?n:g}return!1};
function Im(a){var b=null;a instanceof Kf&&(b=a.spot1,b===dd&&(b=null),a=a.geometry,null!==a&&null===b&&(b=a.spot1));null===b&&(b=Cc);return b}function Jm(a){var b=null;a instanceof Kf&&(b=a.spot2,b===dd&&(b=null),a=a.geometry,null!==a&&null===b&&(b=a.spot2));null===b&&(b=Nc);return b}t.add=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];for(c=0;c<b.length;c++)this.Bb(this.W.count,b[c]);return this};t.M=function(a){return this.W.M(a)};
t.Bb=function(a,b){b instanceof U&&v("Cannot add a Part to a Panel: "+b+"; use a Panel instead");if(this===b||this.Dg(b))this===b&&v("Cannot make a Panel contain itself: "+this.toString()),v("Cannot make a Panel indirectly contain itself: "+this.toString()+" already contains "+b.toString());var c=b.panel;null!==c&&c!==this&&v("Cannot add a GraphObject that already belongs to another Panel to this Panel: "+b.toString()+", already contained by "+c.toString()+", cannot be shared by this Panel: "+this.toString());
this.na!==X.Grid||b instanceof Kf||v("Can only add Shapes to a Grid Panel, not: "+b);this.na!==X.Graduated||b instanceof Kf||b instanceof Yg||v("Can only add Shapes or TextBlocks to a Graduated Panel, not: "+b);b.dj(this);b.Nj=null;if(null!==this.itemArray){var d=b.data;null!==d&&"object"===typeof d&&(null===this.fe&&(this.fe=new yb),this.fe.add(d,b))}var e=this.W;d=-1;if(c===this){for(var f=-1,g=this.W.m,h=g.length,k=0;k<h;k++)if(g[k]===b){f=k;break}if(-1!==f){if(f===a||f+1>=e.count&&a>=e.count)return;
e.kb(f);d=f}else v("element "+b.toString()+" has panel "+c.toString()+" but is not contained by it.")}if(0>a||a>e.count)a=e.count;e.Bb(a,b);if(0===a||b.isPanelMain)this.Ah=null;vj(this)||this.v();b.v(!1);null!==b.portId?this.We=!0:b instanceof X&&!0===b.We&&(this.We=!0);this.cg=null;this.Qf()||on(this,b,!1);c=this.part;null!==c&&(c.xi=null,c.ig=NaN,this.We&&c instanceof V&&(c.We=!0),c.We&&c instanceof V&&(c.tc=null),e=this.diagram,null!==e&&e.undoManager.isUndoingRedoing||(-1!==d&&c.bb(ve,"elements",
this,b,null,d,null),c.bb(ue,"elements",this,null,b,null,a)))};function pn(a,b){a.H=b?a.H|16777216:a.H&-16777217}t.remove=function(a){w(a,O,X,"remove:element");for(var b=this.W.m,c=b.length,d=-1,e=0;e<c;e++)if(b[e]===a){d=e;break}-1!==d&&this.kc(d,!0)};t.kb=function(a){G&&E(a,X,"removeAt:idx");0<=a&&this.kc(a,!0)};
t.kc=function(a,b){var c=this.W,d=c.M(a);d.Nj=null;d.dj(null);if(null!==this.fe){var e=d.data;"object"===typeof e&&this.fe.remove(e)}c.kb(a);qj(this,!1);this.v();this.Ah===d&&(this.Ah=null);this.cg=null;var f=this.part;null!==f&&(f.xi=null,f.ig=NaN,f.Rb(),f instanceof V&&(d instanceof X?d.Bk(d,function(a,c){Xl(f,c,b)}):Xl(f,d,b)),c=this.diagram,null!==c&&c.undoManager.isUndoingRedoing||f.bb(ve,"elements",this,d,null,a,null))};
X.prototype.getRowDefinition=function(a){G&&E(a,X,"getRowDefinition:idx");0>a&&Ba(a,">= 0",X,"getRowDefinition:idx");a=Math.round(a);var b=this.tb;if(void 0===b)return null;if(void 0===b[a]){var c=new Wj;c.dj(this);c.isRow=!0;c.index=a;b[a]=c;this.bb(ue,"rowdefs",this,null,c,null,a)}return b[a]};
X.prototype.cB=function(a){G&&E(a,X,"removeRowDefinition:idx");0>a&&Ba(a,">= 0",X,"removeRowDefinition:idx");a=Math.round(a);var b=this.tb;if(void 0!==b){var c=b[a];if(c){b[a]=void 0;for(var d=b.length-1;0<=d&&void 0===b[d--];)b.length--;this.bb(ve,"rowdefs",this,c,null,a,null);this.v()}}};function Xj(a,b,c){var d=a.tb;if(d&&!(0>b)){d[b]=c instanceof Wj?c:void 0;if(!c)for(b=d.length-1;0<=b&&void 0===d[b--];)d.length--;a.v()}}
X.prototype.getColumnDefinition=function(a){G&&E(a,X,"getColumnDefinition:idx");0>a&&Ba(a,">= 0",X,"getColumnDefinition:idx");a=Math.round(a);var b=this.nb;if(void 0===b)return null;if(void 0===b[a]){var c=new Wj;c.dj(this);c.isRow=!1;c.index=a;b[a]=c;this.bb(ue,"coldefs",this,null,c,null,a)}return b[a]};t=X.prototype;
t.YA=function(a){G&&E(a,X,"removeColumnDefinition:idx");0>a&&Ba(a,">= 0",X,"removeColumnDefinition:idx");a=Math.round(a);var b=this.nb;if(void 0!==b){var c=b[a];if(c){b[a]=void 0;for(var d=b.length-1;0<=d&&void 0===b[d--];)b.length--;this.bb(ve,"coldefs",this,c,null,a,null);this.v()}}};function Yj(a,b,c){var d=a.nb;if(d&&!(0>b)){d[b]=c instanceof Wj?c:void 0;if(!c)for(b=d.length-1;0<=b&&void 0===d[b--];)d.length--;a.v()}}
t.eA=function(a){if(0>a||this.type!==X.Table)return-1;for(var b=0,c=this.tb,d=c.length,e=this.Gi;e<d;e++){var f=c[e];if(void 0!==f&&(b+=f.total,a<b))break}return e};t.Xz=function(a){if(0>a||this.type!==X.Table)return-1;for(var b=0,c=this.nb,d=c.length,e=this.si;e<d;e++){var f=c[e];if(void 0!==f&&(b+=f.total,a<b))break}return e};
t.vA=function(a,b){void 0===b&&(b=new K(NaN,NaN));if(this.type!==X.Graduated)return b.h(NaN,NaN),b;a=Math.min(Math.max(a,this.graduatedMin),this.graduatedMax);var c=this.ub();c.geometry.hv((a-this.graduatedMin)/this.graduatedRange,b);return c.transform.Ga(b)};t.wA=function(a){if(this.type!==X.Graduated)return NaN;var b=this.ub();b.transform.Od(a);return b.geometry.jy(a)*this.graduatedRange+this.graduatedMin};function Ol(a){a=a.ai;return null!==a&&a.u}
function og(a){var b=a.ai;if(null===b)null!==a.data&&v("Template cannot have .data be non-null: "+a),a.ai=b=new H;else if(b.u)return;var c=new H;pn(a,!1);a.Bk(a,function(a,d){var e=d.lb;if(null!==e)for(Ll(d,!1),e=e.iterator;e.next();){var f=e.value;f.mode===qn&&Ll(d,!0);var g=f.sourceName;null!==g&&("/"===g&&pn(a,!0),g=ol(f,a,d),null!==g&&(c.add(g),null===g.Ul&&(g.Ul=new H),g.Ul.add(f)));b.add(f)}if(d instanceof X&&d.type===X.Table){if(0<d.tb.length)for(a=d.tb,e=a.length,f=0;f<e;f++)if(g=a[f],void 0!==
g&&null!==g.lb)for(var h=g.lb.iterator;h.next();){var k=h.value;k.vd=g;k.Kp=2;k.$l=g.index;b.add(k)}if(0<d.nb.length)for(d=d.nb,a=d.length,e=0;e<a;e++)if(f=d[e],void 0!==f&&null!==f.lb)for(g=f.lb.iterator;g.next();)h=g.value,h.vd=f,h.Kp=1,h.$l=f.index,b.add(h)}});for(var d=c.iterator;d.next();){var e=d.value;if(null!==e.Ul){Ll(e,!0);for(var f=e.Ul.iterator;f.next();){var g=f.value;null===e.lb&&(e.lb=new H);e.lb.add(g)}}e.Ul=null}for(var h=b.iterator;h.next();)if(d=h.value,e=d.vd,null!==e){d.vd=null;
g=d.targetProperty;var k=g.indexOf(".");0<k&&e instanceof X&&(f=g.substring(0,k),g=g.substr(k+1),k=e.eb(f),null!==k?(e=k,d.targetProperty=g):Fa('Warning: unable to find GraphObject named "'+f+'" for Binding: '+d.toString()));e instanceof Wj?(f=lb(e.panel),d.ij=void 0===f?-1:f,e.panel.Ok=d.ij):e instanceof O?(f=lb(e),d.ij=void 0===f?-1:f,e.Ok=d.ij):v("Unknown type of binding target: "+e)}b.freeze();a instanceof U&&(a.Tc()&&a.Ya(),G&&!rn&&a.Bk(a,function(a,c){if(c instanceof X&&(c.type===X.Auto||c.type===
X.Spot||c.type===X.Graduated)&&1>=c.elements.count&&!(c instanceof U)){var d=!1;if(1===c.elements.count&&(d=null!==c.itemArray,!d))for(h=b.iterator;h.next();)if("itemArray"===h.value.targetProperty){d=!0;break}d||(Fa("Auto, Spot, or Graduated Panel should not have zero or one elements: "+c.toString()+" in "+a.toString()),rn=!0)}}))}
t.Iz=function(a){void 0===a&&(a=!1);var b=this.copy();hn(b,function(a){a instanceof X&&(a.ai=null,a.ob=null);var b=a.lb;null!==b&&(a.lb=null,b.each(function(b){a.bind(b.copy())}));b=a.Ig;null!==b&&(a.Ig=null,b.each(function(b){a.ew(b.value.copy())}))});a&&og(b);return b};
t.Ka=function(a){var b=this.ai;if(null!==b)for(void 0===a&&(a=""),b=b.iterator;b.next();){var c=b.value,d=c.sourceProperty;if(""===a||""===d||d===a)if(d=c.targetProperty,null!==c.converter||""!==d){d=this.data;var e=c.sourceName;if(null!==e)if(""===e)d=this;else if("/"===e)d=this;else if("."===e)d=this;else if(".."===e)d=this;else{if(d=this.eb(e),null===d){G&&Fa("Binding error: missing GraphObject named "+e+" in "+this.toString());continue}}else if(c.isToModel)if(d=this.diagram,null!==d)d=d.model.modelData;
else continue;var f=this,g=c.ij;if(-1!==g){if(f=this.Bs(g),null===f)continue}else null!==c.vd&&(f=c.vd);"/"===e?d=f.part:"."===e?d=f:".."===e&&(d=f.panel);e=c.Kp;if(0!==e){if(!(f instanceof X))continue;1===e?f=f.getColumnDefinition(c.$l):2===e&&(f=f.getRowDefinition(c.$l))}void 0!==f&&c.iw(f,d)}}};t.by=function(a){if(void 0===a||null===a||null===this.fe)return null;A(a,"object",X,"findItemPanelForData");return this.fe.K(a)};
function sn(a,b){a=a.W.m;for(var c=a.length,d=b.length,e=0,f=null;e<c&&!(f=a[e],f instanceof X&&null!==f.data);)e++,f=a[e];if(c-e!==d)return!0;if(null===f)return 0<d;for(var g=0;e<c&&g<d;){f=a[e];if(!(f instanceof X)||f.data!==b[g])return!0;e++;g++}return!1}
function ln(a){if(a.type===X.Spot||a.type===X.Auto)return Math.min(a.W.length,1);if(a.type===X.Link){a=a.W;for(var b=a.length,c=0;c<b;c++){var d=a.M(c);if(!(d instanceof Kf&&d.isPanelMain))break}return c}return a.type===X.Table&&0<a.W.length&&(a=a.W.M(0),a.isPanelMain&&a instanceof X&&(a.type===X.TableRow||a.type===X.TableColumn))?1:0}t.Lv=function(){for(var a=ln(this);this.W.length>a;)this.kc(this.W.length-1,!1);tn(this,this.itemArray)};
function tn(a,b){var c=ln(a);if(null===b||0===b.length)for(;a.W.length>c;)a.kc(a.W.length-1,!1);else if(a.W.length<=c){c=b.length;for(var d=0;d<c;d++)un(a,b[d],d,!0)}else{d=c;for(var e=0;e<b.length;e++,d++){var f=b[e],g=d<a.W.length?a.W.M(d):null;if(g instanceof X){if(g.data!==f){var h=vn(a,g.data),k=vn(a,f),l=k!==h;l||(h=wn(a,h),l=wn(a,k)!==h);l?(a.kc(d,!1),un(a,f,e,!1)):g.data=f}}else un(a,f,e,!1)}for(;d<a.W.length;)a.kc(d,!1);a.Ah=null;xn(a,c,0);vj(a)||a.v();a.cg=null;a.Qf()||on(a,a,!1);b=a.part;
null!==b&&(b.xi=null,b.ig=NaN,a.We&&b instanceof V&&(b.We=!0),b.We&&b instanceof V&&(b.tc=null))}}function un(a,b,c,d){if(!(void 0===b||null===b||0>c)){var e=vn(a,b);e=wn(a,e);if(null!==e){og(e);e=e.copy();if(0!==(e.H&16777216)){var f=a.Nh();null!==f&&pn(f,!0)}"object"===typeof b&&(null===a.fe&&(a.fe=new yb),a.fe.add(b,e));f=c+ln(a);a.Bb(f,e);d&&(e.ob=b,xn(a,f,c),e.ob=null);e.data=b}}}
function xn(a,b,c){for(a=a.W;b<a.length;){var d=a.M(b);if(d instanceof X){var e=b,f=c;d.type===X.TableRow?d.row=e:d.type===X.TableColumn&&(d.column=e);d.itemIndex=f}b++;c++}}function vn(a,b){if(null===b)return"";a=a.sl;if("function"===typeof a)a=a(b);else if("string"===typeof a&&"object"===typeof b){if(""===a)return"";a=yn(b,a)}else return"";if(void 0===a)return"";if("string"===typeof a)return a;v("Panel.getCategoryForItemData found a non-string category for "+b+": "+a)}
function wn(a,b){var c=a.itemTemplateMap,d=null;null!==c&&(d=c.K(b));null===d&&(null!==c&&(d=c.K("")),null===d&&(zn||(zn=!0,Fa('No item template Panel found for category "'+b+'" on '+a),Fa("  Using default item template."),a=new X,b=new Yg,b.bind(new Fi("text","",Ra)),a.add(b),An=a),d=An));return d}function on(a,b,c){var d=b.enabledChanged;null!==d&&d(b,c);if(b instanceof X){b=b.W.m;d=b.length;for(var e=0;e<d;e++){var f=b[e];c&&f instanceof X&&!f.isEnabled||on(a,f,c)}}}
function Bn(a,b){b.name=a;Sl.add(a,b)}
na.Object.defineProperties(X.prototype,{type:{configurable:!0,get:function(){return this.na},set:function(a){var b=this.na;b!==a&&(this.na=a,this.na===X.Grid?this.isAtomic=!0:this.na===X.Table&&cn(this),this.v(),this.g("type",b,a))}},elements:{configurable:!0,get:function(){return this.W.iterator}},naturalBounds:{configurable:!0,get:function(){return this.Ac}},padding:{configurable:!0,get:function(){return this.sb},set:function(a){"number"===
typeof a?(0>a&&Ba(a,">= 0",X,"padding"),a=new fc(a)):(w(a,fc,X,"padding"),0>a.left&&Ba(a.left,">= 0",X,"padding:value.left"),0>a.right&&Ba(a.right,">= 0",X,"padding:value.right"),0>a.top&&Ba(a.top,">= 0",X,"padding:value.top"),0>a.bottom&&Ba(a.bottom,">= 0",X,"padding:value.bottom"));var b=this.sb;b.B(a)||(this.sb=a=a.L(),this.v(),this.g("padding",b,a))}},defaultAlignment:{configurable:!0,get:function(){return this.yn},set:function(a){var b=this.yn;b.B(a)||(G&&w(a,Ib,X,"defaultAlignment"),
this.yn=a=a.L(),this.v(),this.g("defaultAlignment",b,a))}},defaultStretch:{configurable:!0,get:function(){return this.$f},set:function(a){var b=this.$f;b!==a&&(db(a,O,X,"defaultStretch"),this.$f=a,this.v(),this.g("defaultStretch",b,a))}},defaultSeparatorPadding:{configurable:!0,get:function(){return void 0===this.pj?zc:this.pj},set:function(a){if(void 0!==this.pj){"number"===typeof a?a=new fc(a):G&&w(a,fc,X,"defaultSeparatorPadding");var b=this.pj;b.B(a)||(this.pj=a=a.L(),
this.v(),this.g("defaultSeparatorPadding",b,a))}}},defaultRowSeparatorStroke:{configurable:!0,get:function(){return void 0===this.gi?null:this.gi},set:function(a){var b=this.gi;b!==a&&(null===a||"string"===typeof a||a instanceof vl)&&(a instanceof vl&&a.freeze(),this.gi=a,this.R(),this.g("defaultRowSeparatorStroke",b,a))}},defaultRowSeparatorStrokeWidth:{configurable:!0,get:function(){return void 0===this.Sg?1:this.Sg},set:function(a){if(void 0!==this.Sg){var b=this.Sg;
b!==a&&isFinite(a)&&0<=a&&(this.Sg=a,this.v(),this.g("defaultRowSeparatorStrokeWidth",b,a))}}},defaultRowSeparatorDashArray:{configurable:!0,get:function(){return void 0===this.fi?null:this.fi},set:function(a){if(void 0!==this.fi){var b=this.fi;if(b!==a){null===a||Array.isArray(a)||za(a,"Array",X,"defaultRowSeparatorDashArray:value");if(null!==a){for(var c=a.length,d=0,e=0;e<c;e++){var f=a[e];"number"===typeof f&&0<=f&&isFinite(f)||v("defaultRowSeparatorDashArray value "+f+" at index "+
e+" must be a positive number or zero.");d+=f}if(0===d){if(null===b)return;a=null}}this.fi=a;this.R();this.g("defaultRowSeparatorDashArray",b,a)}}}},defaultColumnSeparatorStroke:{configurable:!0,get:function(){return void 0===this.Qg?null:this.Qg},set:function(a){if(void 0!==this.Qg){var b=this.Qg;b!==a&&(null===a||"string"===typeof a||a instanceof vl)&&(a instanceof vl&&a.freeze(),this.Qg=a,this.R(),this.g("defaultColumnSeparatorStroke",b,a))}}},defaultColumnSeparatorStrokeWidth:{configurable:!0,
enumerable:!0,get:function(){return void 0===this.Rg?1:this.Rg},set:function(a){if(void 0!==this.Rg){var b=this.Rg;b!==a&&isFinite(a)&&0<=a&&(this.Rg=a,this.v(),this.g("defaultColumnSeparatorStrokeWidth",b,a))}}},defaultColumnSeparatorDashArray:{configurable:!0,get:function(){return void 0===this.ei?null:this.ei},set:function(a){if(void 0!==this.ei){var b=this.ei;if(b!==a){null===a||Array.isArray(a)||za(a,"Array",X,"defaultColumnSeparatorDashArray:value");if(null!==a){for(var c=a.length,
d=0,e=0;e<c;e++){var f=a[e];"number"===typeof f&&0<=f&&isFinite(f)||v("defaultColumnSeparatorDashArray value "+f+" at index "+e+" must be a positive number or zero.");d+=f}if(0===d){if(null===b)return;a=null}}this.ei=a;this.R();this.g("defaultColumnSeparatorDashArray",b,a)}}}},viewboxStretch:{configurable:!0,get:function(){return this.Tp},set:function(a){var b=this.Tp;b!==a&&(db(a,O,X,"viewboxStretch"),this.Tp=a,this.v(),this.g("viewboxStretch",b,a))}},gridCellSize:{configurable:!0,
enumerable:!0,get:function(){return this.Wn},set:function(a){var b=this.Wn;if(!b.B(a)){w(a,Hb,X,"gridCellSize");a.s()&&0!==a.width&&0!==a.height||v("Invalid Panel.gridCellSize: "+a);this.Wn=a.L();var c=this.diagram;null!==c&&this===c.grid&&rj(c);this.R();this.g("gridCellSize",b,a)}}},gridOrigin:{configurable:!0,get:function(){return this.Xn},set:function(a){var b=this.Xn;if(!b.B(a)){w(a,K,X,"gridOrigin");a.s()||v("Invalid Panel.gridOrigin: "+a);this.Xn=a.L();var c=this.diagram;null!==
c&&this===c.grid&&rj(c);this.R();this.g("gridOrigin",b,a)}}},graduatedMin:{configurable:!0,get:function(){return this.Tn},set:function(a){E(a,X,"graduatedMin");var b=this.Tn;b!==a&&(this.Tn=a,this.v(),this.g("graduatedMin",b,a),ml(this)&&(a=this.part,null!==a&&nl(this,a,"graduatedRange")))}},graduatedMax:{configurable:!0,get:function(){return this.Sn},set:function(a){E(a,X,"graduatedMax");var b=this.Sn;b!==a&&(this.Sn=a,this.v(),this.g("graduatedMax",b,a),ml(this)&&(a=
this.part,null!==a&&nl(this,a,"graduatedRange")))}},graduatedRange:{configurable:!0,get:function(){return this.graduatedMax-this.graduatedMin}},graduatedTickUnit:{configurable:!0,get:function(){return this.Vn},set:function(a){E(a,X,"graduatedTickUnit");var b=this.Vn;b!==a&&0<a&&(this.Vn=a,this.v(),this.g("graduatedTickUnit",b,a))}},graduatedTickBase:{configurable:!0,get:function(){return this.Un},set:function(a){E(a,X,"graduatedTickBase");var b=this.Un;b!==
a&&(this.Un=a,this.v(),this.g("graduatedTickBase",b,a))}},We:{configurable:!0,get:function(){return 0!==(this.H&8388608)},set:function(a){0!==(this.H&8388608)!==a&&(this.H^=8388608)}},rowCount:{configurable:!0,get:function(){return void 0===this.tb?0:this.tb.length}},columnCount:{configurable:!0,get:function(){return void 0===this.nb?0:this.nb.length}},rowSizing:{configurable:!0,get:function(){return void 0===this.Pj?dn:this.Pj},set:function(a){if(void 0!==
this.Pj){var b=this.Pj;b!==a&&(G&&a!==dn&&a!==Mm&&v("Panel.rowSizing must be RowColumnDefinition.ProportionalExtra or RowColumnDefinition.None, not: "+a),this.Pj=a,this.v(),this.g("rowSizing",b,a))}}},columnSizing:{configurable:!0,get:function(){return void 0===this.oj?dn:this.oj},set:function(a){if(void 0!==this.oj){var b=this.oj;b!==a&&(G&&a!==dn&&a!==Mm&&v("Panel.columnSizing must be RowColumnDefinition.ProportionalExtra or RowColumnDefinition.None, not: "+a),this.oj=a,this.v(),this.g("columnSizing",
b,a))}}},topIndex:{configurable:!0,get:function(){return void 0===this.Gi?0:this.Gi},set:function(a){if(void 0!==this.Gi){var b=this.Gi;b!==a&&((!isFinite(a)||0>a)&&v("Panel.topIndex must be greater than zero and a real number, not: "+a),this.Gi=a,this.v(),this.g("topIndex",b,a))}}},leftIndex:{configurable:!0,get:function(){return void 0===this.si?0:this.si},set:function(a){if(void 0!==this.si){var b=this.si;b!==a&&((!isFinite(a)||0>a)&&v("Panel.leftIndex must be greater than zero and a real number, not: "+
a),this.si=a,this.v(),this.g("leftIndex",b,a))}}},data:{configurable:!0,get:function(){return this.ob},set:function(a){var b=this.ob;if(b!==a){var c=this instanceof U&&!(this instanceof Ke);c&&A(a,"object",X,"data");og(this);this.ob=a;var d=this.diagram;null!==d&&(c?(c=d.partManager,this instanceof R?(null!==b&&c.ff.remove(b),null!==a&&c.ff.add(a,this)):this instanceof U&&(null!==b&&c.gf.remove(b),null!==a&&c.gf.add(a,this))):(c=this.panel,null!==c&&null!==c.fe&&(null!==b&&c.fe.remove(b),
null!==a&&c.fe.add(a,this))));this.g("data",b,a);null!==d&&d.undoManager.isUndoingRedoing||null!==a&&this.Ka()}}},itemIndex:{configurable:!0,get:function(){return this.po},set:function(a){var b=this.po;b!==a&&(this.po=a,this.g("itemIndex",b,a))}},itemArray:{configurable:!0,get:function(){return this.ni},set:function(a){G&&null!==a&&!Array.isArray(a)&&v("Panel.itemArray must be an Array-like object or null, not: "+a);var b=this.ni;if(b!==a||null!==a&&sn(this,a)){var c=this.diagram;
b!==a&&(null!==c&&null!==b&&Nj(c.partManager,this,c),this.ni=a,null!==c&&null!==a&&Kj(c.partManager,this));this.g("itemArray",b,a);null!==c&&c.undoManager.isUndoingRedoing||tn(this,a)}}},itemTemplate:{configurable:!0,get:function(){return null===this.Fe?null:this.Fe.K("")},set:function(a){if(null===this.Fe){if(null===a)return;this.Fe=new yb}var b=this.Fe.K("");b!==a&&(w(a,X,X,"itemTemplate"),(a instanceof U||a.isPanelMain)&&v("Panel.itemTemplate must not be a Part or be Panel.isPanelMain: "+
a),this.Fe.add("",a),this.g("itemTemplate",b,a),a=this.diagram,null!==a&&a.undoManager.isUndoingRedoing||this.Lv())}},itemTemplateMap:{configurable:!0,get:function(){return this.Fe},set:function(a){var b=this.Fe;if(b!==a){w(a,yb,X,"itemTemplateMap");for(var c=a.iterator;c.next();){var d=c.value;G&&(d instanceof U||d.isPanelMain)&&v("Template in Panel.itemTemplateMap must not be a Part or be Panel.isPanelMain: "+d)}this.Fe=a;this.g("itemTemplateMap",b,a);a=this.diagram;null!==a&&a.undoManager.isUndoingRedoing||
this.Lv()}}},itemCategoryProperty:{configurable:!0,get:function(){return this.sl},set:function(a){var b=this.sl;b!==a&&("string"!==typeof a&&"function"!==typeof a&&za(a,"string or function",X,"itemCategoryProperty"),this.sl=a,this.g("itemCategoryProperty",b,a))}},isAtomic:{configurable:!0,get:function(){return 0!==(this.H&1048576)},set:function(a){var b=0!==(this.H&1048576);b!==a&&(A(a,"boolean",X,"isAtomic"),this.H^=1048576,this.g("isAtomic",b,a))}},isClipping:{configurable:!0,
enumerable:!0,get:function(){return 0!==(this.H&2097152)},set:function(a){var b=0!==(this.H&2097152);b!==a&&(G&&(A(a,"boolean",X,"isClipping"),!a||this.type===X.Spot||this instanceof yf||Fa("Warning: Panel.isClipping set on non-Spot Panel: "+this.toString())),this.H^=2097152,this instanceof yf&&(this.hb=null),this.v(),this.g("isClipping",b,a))}},isOpposite:{configurable:!0,get:function(){return 0!==(this.H&33554432)},set:function(a){var b=0!==(this.H&33554432);b!==a&&(A(a,"boolean",
X,"isOpposite"),this.H^=33554432,this.v(),this.g("isOpposite",b,a))}},isEnabled:{configurable:!0,get:function(){return 0!==(this.H&4194304)},set:function(a){var b=0!==(this.H&4194304);if(b!==a){A(a,"boolean",X,"isEnabled");var c=null===this.panel||this.panel.Qf();this.H^=4194304;this.g("isEnabled",b,a);b=this.diagram;null!==b&&b.undoManager.isUndoingRedoing||c&&on(this,this,a)}}},alignmentFocusName:{configurable:!0,get:function(){return this.cf},set:function(a){var b=this.cf;
b!==a&&(G&&A(a,"string",X,"alignmentFocusName"),this.cf=a,this.v(),this.g("alignmentFocusName",b,a))}}});
na.Object.defineProperties(X,{Position:{configurable:!0,get:function(){return Sl.K("Position")}},Horizontal:{configurable:!0,get:function(){return Sl.K("Horizontal")}},Vertical:{configurable:!0,get:function(){return Sl.K("Vertical")}},Spot:{configurable:!0,get:function(){return Sl.K("Spot")}},Auto:{configurable:!0,get:function(){return Sl.K("Auto")}},Table:{configurable:!0,get:function(){return Sl.K("Table")}},Viewbox:{configurable:!0,
enumerable:!0,get:function(){return Sl.K("Viewbox")}},TableRow:{configurable:!0,get:function(){return Sl.K("TableRow")}},TableColumn:{configurable:!0,get:function(){return Sl.K("TableColumn")}},Link:{configurable:!0,get:function(){return Sl.K("Link")}},Grid:{configurable:!0,get:function(){return Sl.K("Grid")}},Graduated:{configurable:!0,get:function(){return Sl.K("Graduated")}}});X.prototype.rebuildItemElements=X.prototype.Lv;
X.prototype.findItemPanelForData=X.prototype.by;X.prototype.updateTargetBindings=X.prototype.Ka;X.prototype.copyTemplate=X.prototype.Iz;X.prototype.graduatedValueForPoint=X.prototype.wA;X.prototype.graduatedPointForValue=X.prototype.vA;X.prototype.findColumnForLocalX=X.prototype.Xz;X.prototype.findRowForLocalY=X.prototype.eA;X.prototype.removeColumnDefinition=X.prototype.YA;X.prototype.removeRowDefinition=X.prototype.cB;X.prototype.removeAt=X.prototype.kb;X.prototype.remove=X.prototype.remove;
X.prototype.insertAt=X.prototype.Bb;X.prototype.elt=X.prototype.M;X.prototype.add=X.prototype.add;X.prototype.findObject=X.prototype.eb;X.prototype.findInVisualTree=X.prototype.lm;X.prototype.walkVisualTreeFrom=X.prototype.Bk;X.prototype.findMainElement=X.prototype.ub;var rn=!1,zn=!1,An=null,Sl=new yb;X.className="Panel";X.definePanelLayout=Bn;Bn("Position",new Bm);Bn("Vertical",new Em);Bn("Auto",new Hm);Bn("Link",new Sm);
function Wj(){ab(this);this.ng=null;this.Br=!0;this.Xa=0;this.Cc=NaN;this.Ij=0;this.Hj=Infinity;this.Db=dd;this.pa=this.ic=this.ra=0;this.lb=null;this.Dp=Cn;this.Qe=cl;this.yp=this.qg=null;this.zp=NaN;this.Zb=this.Tj=null;this.un=!1}
Wj.prototype.copy=function(){var a=new Wj;a.Br=this.Br;a.Xa=this.Xa;a.Cc=this.Cc;a.Ij=this.Ij;a.Hj=this.Hj;a.Db=this.Db;a.ra=this.ra;a.ic=this.ic;a.pa=this.pa;a.Qe=this.Qe;a.Dp=this.Dp;null===this.qg?a.qg=null:a.qg=this.qg.L();a.yp=this.yp;a.zp=this.zp;a.Tj=null;null!==this.Tj&&(a.separatorDashArray=Ja(this.separatorDashArray));a.Zb=this.Zb;a.un=this.un;a.lb=this.lb;return a};t=Wj.prototype;t.mb=function(a){a.classType===Wj?this.sizing=a:Ea(this,a)};
t.toString=function(){return"RowColumnDefinition "+(this.isRow?"(Row ":"(Column ")+this.index+") #"+lb(this)};t.dj=function(a){this.ng=a};
t.Pu=function(){var a=0,b=0,c=this.ng,d=this.isRow;if(null!==c&&c.type===X.Table)for(var e=d?c.tb.length:c.nb.length,f=0;f<e;f++){var g=d?c.tb[f]:c.nb[f];if(void 0!==g){b=g.index;break}}this.index!==b&&(b=this.separatorStroke,null===b&&null!==c&&(b=this.isRow?c.defaultRowSeparatorStroke:c.defaultColumnSeparatorStroke),null!==b&&(a=this.separatorStrokeWidth,isNaN(a)&&(null!==c?a=this.isRow?c.defaultRowSeparatorStrokeWidth:c.defaultColumnSeparatorStrokeWidth:a=0)));b=this.qg;if(null===b)if(null!==c)b=
c.defaultSeparatorPadding;else return a;return a+(this.isRow?b.top:b.left)};
t.Pc=function(){var a=0,b=this.ng,c=0,d=this.isRow;if(null!==b&&b.type===X.Table)for(var e=d?b.tb.length:b.nb.length,f=0;f<e;f++){var g=d?b.tb[f]:b.nb[f];if(void 0!==g){c=g.index;break}}this.index!==c&&(c=this.separatorStroke,null===c&&null!==b&&(c=d?b.defaultRowSeparatorStroke:b.defaultColumnSeparatorStroke),null!==c&&(a=this.separatorStrokeWidth,isNaN(a)&&(null!==b?a=d?b.defaultRowSeparatorStrokeWidth:b.defaultColumnSeparatorStrokeWidth:a=0)));d=this.qg;if(null===d)if(null!==b)d=b.defaultSeparatorPadding;
else return a;return a+(this.isRow?d.top+d.bottom:d.left+d.right)};t.Ib=function(a,b,c){var d=this.ng;if(null!==d&&(d.bb(se,a,this,b,c,void 0,void 0),null!==this.lb&&(b=d.diagram,null!==b&&!b.skipsModelSourceBindings&&(d=d.Nh(),null!==d&&(b=d.data,null!==b)))))for(c=this.lb.iterator;c.next();)c.value.Nq(this,b,a,d)};function Lm(a){if(a.sizing===Cn){var b=a.ng;return a.isRow?b.rowSizing:b.columnSizing}return a.sizing}
t.bind=function(a,b,c,d){var e=null;"string"===typeof a?e=new Fi(a,b,c,d):e=a;e.vd=this;a=this.panel;null!==a&&(b=a.Nh(),null!==b&&Ol(b)&&v("Cannot add a Binding to a RowColumnDefinition that is already frozen: "+e+" on "+a));null===this.lb&&(this.lb=new H);this.lb.add(e);return this};
na.Object.defineProperties(Wj.prototype,{panel:{configurable:!0,get:function(){return this.ng}},isRow:{configurable:!0,get:function(){return this.Br},set:function(a){this.Br=a}},index:{configurable:!0,get:function(){return this.Xa},set:function(a){this.Xa=a}},height:{configurable:!0,get:function(){return this.Cc},set:function(a){var b=this.Cc;b!==a&&(G&&A(a,"number",Wj,"height"),0>a&&Ba(a,">= 0",Wj,"height"),this.Cc=a,this.actual=this.ra,null!==
this.panel&&this.panel.v(),this.Ib("height",b,a))}},width:{configurable:!0,get:function(){return this.Cc},set:function(a){var b=this.Cc;b!==a&&(G&&A(a,"number",Wj,"width"),0>a&&Ba(a,">= 0",Wj,"width"),this.Cc=a,this.actual=this.ra,null!==this.panel&&this.panel.v(),this.Ib("width",b,a))}},minimum:{configurable:!0,get:function(){return this.Ij},set:function(a){var b=this.Ij;b!==a&&(G&&A(a,"number",Wj,"minimum"),(0>a||!isFinite(a))&&Ba(a,">= 0",Wj,"minimum"),this.Ij=a,this.actual=
this.ra,null!==this.panel&&this.panel.v(),this.Ib("minimum",b,a))}},maximum:{configurable:!0,get:function(){return this.Hj},set:function(a){var b=this.Hj;b!==a&&(G&&A(a,"number",Wj,"maximum"),0>a&&Ba(a,">= 0",Wj,"maximum"),this.Hj=a,this.actual=this.ra,null!==this.panel&&this.panel.v(),this.Ib("maximum",b,a))}},alignment:{configurable:!0,get:function(){return this.Db},set:function(a){var b=this.Db;b.B(a)||(G&&w(a,Ib,Wj,"alignment"),this.Db=a.L(),null!==this.panel&&this.panel.v(),
this.Ib("alignment",b,a))}},stretch:{configurable:!0,get:function(){return this.Qe},set:function(a){var b=this.Qe;b!==a&&(G&&db(a,O,Wj,"stretch"),this.Qe=a,null!==this.panel&&this.panel.v(),this.Ib("stretch",b,a))}},separatorPadding:{configurable:!0,get:function(){return this.qg},set:function(a){"number"===typeof a?a=new fc(a):null!==a&&G&&w(a,fc,Wj,"separatorPadding");var b=this.qg;null!==a&&null!==b&&b.B(a)||(null!==a&&(a=a.L()),this.qg=a,null!==this.panel&&this.panel.v(),
this.Ib("separatorPadding",b,a))}},separatorStroke:{configurable:!0,get:function(){return this.yp},set:function(a){var b=this.yp;b!==a&&(null!==a&&Wl(a,"RowColumnDefinition.separatorStroke"),a instanceof vl&&a.freeze(),this.yp=a,null!==this.panel&&this.panel.v(),this.Ib("separatorStroke",b,a))}},separatorStrokeWidth:{configurable:!0,get:function(){return this.zp},set:function(a){var b=this.zp;b!==a&&(this.zp=a,null!==this.panel&&this.panel.v(),this.Ib("separatorStrokeWidth",
b,a))}},separatorDashArray:{configurable:!0,get:function(){return this.Tj},set:function(a){var b=this.Tj;if(b!==a){null===a||Array.isArray(a)||za(a,"Array",Wj,"separatorDashArray:value");if(null!==a){for(var c=a.length,d=0,e=0;e<c;e++){var f=a[e];"number"===typeof f&&0<=f&&isFinite(f)||v("separatorDashArray value "+f+" at index "+e+" must be a positive number or zero.");d+=f}if(0===d){if(null===b)return;a=null}}this.Tj=a;null!==this.panel&&this.panel.R();this.Ib("separatorDashArray",
b,a)}}},background:{configurable:!0,get:function(){return this.Zb},set:function(a){var b=this.Zb;b!==a&&(null!==a&&Wl(a,"RowColumnDefinition.background"),a instanceof vl&&a.freeze(),this.Zb=a,null!==this.panel&&this.panel.R(),this.Ib("background",b,a))}},coversSeparators:{configurable:!0,get:function(){return this.un},set:function(a){var b=this.un;b!==a&&(A(a,"boolean",Wj,"coversSeparators"),this.un=a,null!==this.panel&&this.panel.R(),this.Ib("coversSeparators",b,a))}},
sizing:{configurable:!0,get:function(){return this.Dp},set:function(a){var b=this.Dp;b!==a&&(G&&db(a,Wj,Wj,"sizing"),this.Dp=a,null!==this.panel&&this.panel.v(),this.Ib("sizing",b,a))}},actual:{configurable:!0,get:function(){return this.ra},set:function(a){this.ra=isNaN(this.Cc)?Math.max(Math.min(this.Hj,a),this.Ij):Math.max(Math.min(this.Hj,this.Cc),this.Ij)}},measured:{configurable:!0,get:function(){return this.ic},set:function(a){this.ic=a}},total:{configurable:!0,
enumerable:!0,get:function(){return this.ra+this.Pc()}},position:{configurable:!0,get:function(){return this.pa},set:function(a){this.pa=a}}});Wj.prototype.computeEffectiveSpacing=Wj.prototype.Pc;Wj.prototype.computeEffectiveSpacingTop=Wj.prototype.Pu;var Cn=new F(Wj,"Default",0),Mm=new F(Wj,"None",1),dn=new F(Wj,"ProportionalExtra",2);Wj.className="RowColumnDefinition";Wj.Default=Cn;Wj.None=Mm;Wj.ProportionalExtra=dn;
function Kf(a,b){O.call(this);this.Kd=this.sa=null;this.Jn="None";this.Qn=cl;this.Nc=this.el="black";this.tg=1;this.Wl="butt";this.Xl="miter";this.Uj=10;this.xh=null;this.yh=0;this.Af=this.zf=dd;this.Yo=this.Xo=NaN;this.fo=!1;this.$o=null;this.gl=this.cm="None";this.ee=1;this.ce=0;this.ae=1;this.be=null;"string"===typeof a?this.figure=a:a&&Object.assign(this,a);b&&Object.assign(this,b)}ma(Kf,O);
Kf.prototype.cloneProtected=function(a){O.prototype.cloneProtected.call(this,a);a.sa=this.sa;a.Jn=this.Jn;a.Qn=this.Qn;a.Kd=this.Kd;a.el=this.el;a.Nc=this.Nc;a.tg=this.tg;a.Wl=this.Wl;a.Xl=this.Xl;a.Uj=this.Uj;null!==this.xh&&(a.xh=Ja(this.xh));a.yh=this.yh;a.zf=this.zf.L();a.Af=this.Af.L();a.Xo=this.Xo;a.Yo=this.Yo;a.fo=this.fo;a.$o=this.$o;a.cm=this.cm;a.gl=this.gl;a.ee=this.ee;a.ce=this.ce;a.ae=this.ae;a.be=this.be};t=Kf.prototype;
t.mb=function(a){a===pg||a===rg||a===fl||a===cl?this.geometryStretch=a:O.prototype.mb.call(this,a)};t.toString=function(){return"Shape("+("None"!==this.figure?this.figure:"None"!==this.toArrow?this.toArrow:this.fromArrow)+")#"+lb(this)};
function Dn(a,b,c,d){var e=c.length;if(!(4>e)){var f=d.measuredBounds,g=Math.max(1,f.width);f=f.height;for(var h=c[0],k=c[1],l,m,n,p,r,q,u=0,x=Na(),y=2;y<e;y+=2)l=c[y],m=c[y+1],n=l-h,h=m-k,0===n&&(n=.001),p=h/n,r=Math.atan2(h,n),q=Math.sqrt(n*n+h*h),x.push([n,r,p,q]),u+=q,h=l,k=m;h=c[0];k=c[1];n=d.measuredBounds.width;d instanceof Kf&&(n-=d.strokeWidth);1>n&&(n=1);e=c=n;l=g/2;m=0===l?!1:!0;y=0;q=x[y];n=q[0];r=q[1];p=q[2];q=q[3];for(var z=0;.1<=u;){0===z&&(m?(e=c,e-=l,u-=l,m=!1):e=c,0===e&&(e=1));
if(e>u){Pa(x);return}e>q?(z=e-q,e=q):z=0;var B=Math.sqrt(e*e/(1+p*p));0>n&&(B=-B);h+=B;k+=p*B;a.translate(h,k);a.rotate(r);a.translate(-(g/2),-(f/2));0===z&&d.Pi(a,b);a.translate(g/2,f/2);a.rotate(-r);a.translate(-h,-k);u-=e;q-=e;if(0!==z){y++;if(y===x.length){Pa(x);return}q=x[y];n=q[0];r=q[1];p=q[2];q=q[3];e=z}}Pa(x)}}
t.Pi=function(a,b){var c=this.Nc,d=this.el;if(null!==c||null!==d){var e=this.sa;if(null!==e){a.Ld();var f=this.actualBounds,g=this.naturalBounds;null!==d&&pi(this,a,d,!0,!1,g,f);var h=this.part,k=this.tg;null===c||0!==k||null===h||!this.isPanelMain&&h.ub()!==this||(k=h.type===X.Link&&h instanceof Ke&&"Selection"===h.category&&h.adornedObject instanceof Kf&&h.adornedPart.ub()===h.adornedObject?h.adornedObject.strokeWidth:0);0===k&&(c=null);null!==c&&0!==k&&(pi(this,a,c,!1,!1,g,f),a.lineWidth=k,a.lineJoin=
this.Xl,a.lineCap=this.Wl,a.miterLimit=this.Uj);f=!1;h&&b.Ve("drawShadows")&&(f=h.isShadowed);h=!0;null===c||null!==d&&"transparent"!==d||(h=!1);g=!1;k=this.strokeDashArray;null!==k&&(g=!0,a.As(k,this.yh));if(e.type===N.j)a.beginPath(),a.moveTo(e.startX,e.startY),a.lineTo(e.endX,e.endY),null!==c&&a.hj();else if(e.type===N.F){var l=e.startX;k=e.startY;var m=e.endX,n=e.endY;e=Math.min(l,m);var p=Math.min(k,n);l=Math.abs(m-l);k=Math.abs(n-k);a.beginPath();a.rect(e,p,l,k);null!==d&&a.Kf(d);if(null!==
c){h&&f&&zl(a);if(0===l||0===k)a.beginPath(),a.rect(e,p,Math.max(l,.1),Math.max(k,.1));a.hj();h&&f&&yl(a)}}else if(e.type===N.O)l=e.startX,k=e.startY,m=e.endX,n=e.endY,e=Math.abs(m-l)/2,p=Math.abs(n-k)/2,l=Math.min(l,m)+e,k=Math.min(k,n)+p,a.beginPath(),a.moveTo(l,k-p),a.bezierCurveTo(l+L.Hg*e,k-p,l+e,k-L.Hg*p,l+e,k),a.bezierCurveTo(l+e,k+L.Hg*p,l+L.Hg*e,k+p,l,k+p),a.bezierCurveTo(l-L.Hg*e,k+p,l-e,k+L.Hg*p,l-e,k),a.bezierCurveTo(l-e,k-L.Hg*p,l-L.Hg*e,k-p,l,k-p),a.closePath(),null!==d&&a.Kf(d),null!==
c&&(h&&f?(zl(a),a.hj(),yl(a)):a.hj());else if(e.type===N.o)for(e=e.figures,k=e.length,p=0;p<k;p++){l=e.m[p];a.beginPath();a.moveTo(l.startX,l.startY);m=l.segments.m;n=m.length;for(var r=null,q=0;q<n;q++){var u=m[q];switch(u.type){case Qd:a.moveTo(u.endX,u.endY);break;case Dd:a.lineTo(u.endX,u.endY);break;case Rd:a.bezierCurveTo(u.point1X,u.point1Y,u.point2X,u.point2Y,u.endX,u.endY);break;case Sd:a.quadraticCurveTo(u.point1X,u.point1Y,u.endX,u.endY);break;case Td:if(u.radiusX===u.radiusY){var x=Math.PI/
180;a.arc(u.point1X,u.point1Y,u.radiusX,u.startAngle*x,(u.startAngle+u.sweepAngle)*x,0>u.sweepAngle,null!==r?r.endX:l.startX,null!==r?r.endY:l.startY)}else if(r=fe(u,l),x=r.length,0===x)a.lineTo(u.centerX,u.centerY);else for(var y=0;y<x;y++){var z=r[y];0===y&&a.lineTo(z[0],z[1]);a.bezierCurveTo(z[2],z[3],z[4],z[5],z[6],z[7])}break;case ee:y=x=0;if(null!==r&&r.type===Td){r=fe(r,l);z=r.length;if(0===z){a.lineTo(u.endX,u.endY);break}r=r[z-1]||null;null!==r&&(x=r[6],y=r[7])}else x=null!==r?r.endX:l.startX,
y=null!==r?r.endY:l.startY;r=ge(u,l,x,y);x=r.length;if(0===x){a.lineTo(u.endX,u.endY);break}for(y=0;y<x;y++)z=r[y],a.bezierCurveTo(z[2],z[3],z[4],z[5],z[6],z[7]);break;default:v("Segment not of valid type: "+u.type)}u.isClosed&&a.closePath();r=u}m=l.isFilled;f?l.isShadowed?(!0===m&&"transparent"!==d&&null!==d&&a.Kf(d),null!==c&&(m&&h&&zl(a),a.hj(),m&&h&&yl(a))):(zl(a),m&&"transparent"!==d&&null!==d&&a.Kf(d),null!==c&&a.hj(),yl(a)):(m&&null!==d&&a.Kf(d),null!==c&&a.hj())}g&&a.ys();if(null!==this.pathPattern){c=
this.pathPattern;c.measure(Infinity,Infinity);d=c.measuredBounds;c.arrange(0,0,d.width,d.height);f=this.geometry;a.save();a.beginPath();d=Na();if(f.type===N.j)d.push(f.startX),d.push(f.startY),d.push(f.endX),d.push(f.endY),Dn(a,b,d,c);else if(f.type===N.o)for(f=f.figures.iterator;f.next();){h=f.value;d.length=0;d.push(h.startX);d.push(h.startY);g=h.startX;e=h.startY;k=g;p=e;l=h.segments.m;m=l.length;for(n=0;n<m;n++){q=l[n];switch(q.type){case Qd:Dn(a,b,d,c);d.length=0;d.push(q.endX);d.push(q.endY);
g=q.endX;e=q.endY;k=g;p=e;break;case Dd:d.push(q.endX);d.push(q.endY);g=q.endX;e=q.endY;break;case Rd:L.Se(g,e,q.point1X,q.point1Y,q.point2X,q.point2Y,q.endX,q.endY,.5,d);g=q.endX;e=q.endY;break;case Sd:L.yq(g,e,q.point1X,q.point1Y,q.endX,q.endY,.5,d);g=q.endX;e=q.endY;break;case Td:u=fe(q,h);r=u.length;if(0===r){d.push(q.centerX);d.push(q.centerY);g=q.centerX;e=q.centerY;break}for(x=0;x<r;x++)y=u[x],L.Se(g,e,y[2],y[3],y[4],y[5],y[6],y[7],.5,d),g=y[6],e=y[7];break;case ee:u=ge(q,h,g,e);r=u.length;
if(0===r){d.push(q.endX);d.push(q.endY);g=q.endX;e=q.endY;break}for(x=0;x<r;x++)y=u[x],L.Se(g,e,y[2],y[3],y[4],y[5],y[6],y[7],.5,d),g=y[6],e=y[7];break;default:v("Segment not of valid type: "+q.type)}q.isClosed&&(d.push(k),d.push(p),Dn(a,b,d,c))}Dn(a,b,d,c)}else if(f.type===N.F)d.push(f.startX),d.push(f.startY),d.push(f.endX),d.push(f.startY),d.push(f.endX),d.push(f.endY),d.push(f.startX),d.push(f.endY),d.push(f.startX),d.push(f.startY),Dn(a,b,d,c);else if(f.type===N.O){e=new le;e.startX=f.endX;e.startY=
(f.startY+f.endY)/2;g=new me(Td);g.startAngle=0;g.sweepAngle=360;g.centerX=(f.startX+f.endX)/2;g.centerY=(f.startY+f.endY)/2;g.radiusX=Math.abs(f.startX-f.endX)/2;g.radiusY=Math.abs(f.startY-f.endY)/2;e.add(g);f=fe(g,e);h=f.length;if(0===h)d.push(g.centerX),d.push(g.centerY);else for(g=e.startX,e=e.startY,k=0;k<h;k++)p=f[k],L.Se(g,e,p[2],p[3],p[4],p[5],p[6],p[7],.5,d),g=p[6],e=p[7];Dn(a,b,d,c)}Pa(d);a.restore();a.Oc(!1)}}}};
t.ja=function(a,b){void 0===b&&(b=new K);if(a instanceof Ib){a.ec()&&v("getDocumentPoint Spot must be a real, specific Spot, not: "+a.toString());var c=this.naturalBounds,d=this.strokeWidth;b.h(a.x*(c.width+d)-d/2+c.x+a.offsetX,a.y*(c.height+d)-d/2+c.y+a.offsetY)}else b.set(a);this.ne.Ga(b);return b};
t.Wi=function(a){void 0===a&&(a=new M);var b=this.naturalBounds,c=this.ne;b=M.allocAt(b.x,b.y,b.width,b.height);var d=this.strokeWidth;b.Qc(d/2,d/2);d=K.allocAt(b.x,b.y).transform(c);a.h(d.x,d.y,0,0);d.h(b.right,b.y).transform(c);ic(a,d.x,d.y,0,0);d.h(b.right,b.bottom).transform(c);ic(a,d.x,d.y,0,0);d.h(b.x,b.bottom).transform(c);ic(a,d.x,d.y,0,0);M.free(b);K.free(d);return a};
t.Mh=function(a,b){var c=this.geometry;if(null===c||null===this.fill&&null===this.stroke)return!1;var d=c.bounds,e=this.strokeWidth/2;c.type!==N.j||b||(e+=2);var f=M.alloc();f.assign(d);f.Qc(e+2,e+2);if(!f.ca(a))return M.free(f),!1;d=e+1E-4;if(c.type===N.j){if(null===this.stroke)return!1;d=(c.endX-c.startX)*(a.x-c.startX)+(c.endY-c.startY)*(a.y-c.startY);if(0>(c.startX-c.endX)*(a.x-c.endX)+(c.startY-c.endY)*(a.y-c.endY)||0>d)return!1;M.free(f);return L.Sb(c.startX,c.startY,c.endX,c.endY,e,a.x,a.y)}if(c.type===
N.F){b=c.startX;var g=c.startY,h=c.endX;c=c.endY;f.x=Math.min(b,h);f.y=Math.min(g,c);f.width=Math.abs(h-b);f.height=Math.abs(c-g);if(null===this.fill){f.Qc(-d,-d);if(f.ca(a))return M.free(f),!1;f.Qc(d,d)}null!==this.stroke&&f.Qc(e,e);a=f.ca(a);M.free(f);return a}if(c.type===N.O){g=c.startX;e=c.startY;h=c.endX;var k=c.endY;c=Math.min(g,h);b=Math.min(e,k);g=Math.abs(h-g)/2;e=Math.abs(k-e)/2;c=a.x-(c+g);b=a.y-(b+e);if(null===this.fill){g-=d;e-=d;if(0>=g||0>=e||1>=c*c/(g*g)+b*b/(e*e))return M.free(f),
!1;g+=d;e+=d}null!==this.stroke&&(g+=d,e+=d);M.free(f);return 0>=g||0>=e?!1:1>=c*c/(g*g)+b*b/(e*e)}if(c.type===N.o)return M.free(f),null===this.fill?je(c,a.x,a.y,e):he(c,a,e,1<this.strokeWidth,b);v("Unknown Geometry type: "+c.type)};
t.um=function(a,b,c,d){var e=this.desiredSize,f=this.tg;a=Math.max(a,0);b=Math.max(b,0);if(null!==this.Kd)var g=this.geometry.bounds;else{var h=this.figure,k=En[h];if(void 0===k){var l=L.se[h];"string"===typeof l&&(l=L.se[l]);"function"===typeof l?(k=l(null,100,100),En[h]=k):v("Unsupported Figure: "+h)}g=k.bounds}h=g.width;k=g.height;l=g.width;var m=g.height;switch(ql(this,!0)){case pg:d=c=0;break;case Bd:l=Math.max(a-f,0);m=Math.max(b-f,0);break;case dl:l=Math.max(a-f,0);d=0;break;case el:c=0,m=
Math.max(b-f,0)}isFinite(e.width)&&(l=e.width);isFinite(e.height)&&(m=e.height);e=this.maxSize;g=this.minSize;c=Math.max(c-f,g.width);d=Math.max(d-f,g.height);l=Math.min(e.width,l);m=Math.min(e.height,m);l=isFinite(l)?Math.max(c,l):Math.max(h,c);m=isFinite(m)?Math.max(d,m):Math.max(k,d);c=qg(this);switch(c){case pg:break;case Bd:h=l;k=m;break;case rg:c=Math.min(l/h,m/k);isFinite(c)||(c=1);h*=c;k*=c;break;default:v(c+" is not a valid geometryStretch.")}null!==this.Kd?(0===h&&(h=.001),0===k&&(k=.001),
c=null!==this.Kd?this.Kd:this.sa,e=c.bounds,d=h/e.width,e=k/e.height,isFinite(d)||(d=1),isFinite(e)||(e=1),c=1===d&&1===e?c:c.copy().scale(d,e),G&&c.freeze(),this.sa=c):null!==this.sa&&L.da(this.sa.nl,a-f)&&L.da(this.sa.ml,b-f)||(this.sa=Kf.makeGeometry(this,h,k));g=this.sa.bounds;Infinity===a||Infinity===b?this.Ie(g.x-f/2,g.y-f/2,0===a&&0===h?0:g.width+f,0===b&&0===k?0:g.height+f):this.Ie(-(f/2),-(f/2),l+f,m+f)};
function qg(a){var b=a.geometryStretch;return null!==a.Kd?b===cl?Bd:b:b===cl?En[a.figure].defaultStretch:b}t.Kh=function(a,b,c,d){sl(this,a,b,c,d)};t.Is=function(a,b,c){return this.kk(a.x,a.y,b.x,b.y,c)};
t.kk=function(a,b,c,d,e){var f=this.transform,g=1/(f.m11*f.m22-f.m12*f.m21),h=f.m22*g,k=-f.m12*g,l=-f.m21*g,m=f.m11*g,n=g*(f.m21*f.dy-f.m22*f.dx),p=g*(f.m12*f.dx-f.m11*f.dy);f=a*h+b*l+n;g=a*k+b*m+p;h=c*h+d*l+n;k=c*k+d*m+p;n=this.tg/2;l=this.sa;null===l&&(this.measure(Infinity,Infinity),l=this.sa);var r=l.bounds;m=!1;if(l.type===N.j)if(1.5>=this.strokeWidth)m=L.Ye(l.startX,l.startY,l.endX,l.endY,f,g,h,k,e);else{l.startX===l.endX?(d=n,m=0):(b=(l.endY-l.startY)/(l.endX-l.startX),m=n/Math.sqrt(1+b*b),
d=m*b);b=Na();a=new K;L.Ye(l.startX+d,l.startY+m,l.endX+d,l.endY+m,f,g,h,k,a)&&b.push(a);a=new K;L.Ye(l.startX-d,l.startY-m,l.endX-d,l.endY-m,f,g,h,k,a)&&b.push(a);a=new K;L.Ye(l.startX+d,l.startY+m,l.startX-d,l.startY-m,f,g,h,k,a)&&b.push(a);a=new K;L.Ye(l.endX+d,l.endY+m,l.endX-d,l.endY-m,f,g,h,k,a)&&b.push(a);h=b.length;if(0===h)return Pa(b),!1;m=!0;k=Infinity;for(d=0;d<h;d++)a=b[d],c=(a.x-f)*(a.x-f)+(a.y-g)*(a.y-g),c<k&&(k=c,e.x=a.x,e.y=a.y);Pa(b)}else if(l.type===N.F)m=L.Of(r.x-n,r.y-n,r.x+r.width+
n,r.y+r.height+n,f,g,h,k,e);else if(l.type===N.O){b=M.allocAt(r.x,r.y,r.width,r.height).Qc(n,n);a:if(0===b.width)m=L.Ye(b.x,b.y,b.x,b.y+b.height,f,g,h,k,e);else if(0===b.height)m=L.Ye(b.x,b.y,b.x+b.width,b.y,f,g,h,k,e);else{a=b.width/2;l=b.height/2;d=b.x+a;m=b.y+l;c=9999;f!==h&&(c=(g-k)/(f-h));if(9999>Math.abs(c)){k=g-m-c*(f-d);if(0>a*a*c*c+l*l-k*k){e.x=NaN;e.y=NaN;m=!1;break a}n=Math.sqrt(a*a*c*c+l*l-k*k);h=(-(a*a*c*k)+a*l*n)/(l*l+a*a*c*c)+d;a=(-(a*a*c*k)-a*l*n)/(l*l+a*a*c*c)+d;l=c*(h-d)+k+m;k=c*
(a-d)+k+m;Math.abs((f-h)*(f-h))+Math.abs((g-l)*(g-l))<Math.abs((f-a)*(f-a))+Math.abs((g-k)*(g-k))?(e.x=h,e.y=l):(e.x=a,e.y=k)}else{h=l*l;k=f-d;h-=h/(a*a)*k*k;if(0>h){e.x=NaN;e.y=NaN;m=!1;break a}k=Math.sqrt(h);h=m+k;k=m-k;Math.abs(h-g)<Math.abs(k-g)?(e.x=f,e.y=h):(e.x=f,e.y=k)}m=!0}M.free(b)}else if(l.type===N.o){p=K.alloc();var q=h-f;var u=k-g,x=q*q+u*u,y=f,z=g;if(0<x&&r.contains(y,z)&&(p.x=y,p.y=z,this.ca(p)))for(0!==q&&.5>Math.abs(q)?(u*=.5/q,q=.5):0!==u&&.5>Math.abs(u)&&(q*=.5/u,u=.5),y-=q,z-=
u;r.contains(y,z);)y-=q,z-=u;e.x=h;e.y=k;for(u=0;u<l.figures.count;u++){var B=l.figures.m[u],D=B.isFilled?y:f,C=B.isFilled?z:g,J=B.segments;r=B.startX;q=B.startY;for(var S=r,T=q,aa=0;aa<J.count;aa++){var W=J.m[aa],P=W.type;var qa=W.endX;var ia=W.endY;var Aa=!1;switch(P){case Qd:S=qa;T=ia;break;case Dd:Aa=Fn(r,q,qa,ia,D,C,h,k,p);break;case Rd:Aa=L.$p(r,q,W.point1X,W.point1Y,W.point2X,W.point2Y,qa,ia,D,C,h,k,.6,p);break;case Sd:Aa=L.$p(r,q,r+2/3*(W.point1X-r),q+2/3*(W.point1Y-q),qa+2/3*(W.point1X-qa),
ia+2/3*(W.point1Y-ia),qa,ia,D,C,h,k,.6,p);break;case Td:case ee:P=W.type===Td?fe(W,B):ge(W,B,r,q);var Ma=P.length;if(0===Ma){Aa=Fn(r,q,W.type===Td?W.centerX:W.endX,W.type===Td?W.centerY:W.endY,D,C,h,k,p);break}ia=null;for(qa=0;qa<Ma;qa++){ia=P[qa];if(0===qa&&Fn(r,q,ia[0],ia[1],D,C,h,k,p)){var pb=Gn(D,C,p,x,e);pb<x&&(x=pb,m=!0)}L.$p(ia[0],ia[1],ia[2],ia[3],ia[4],ia[5],ia[6],ia[7],D,C,h,k,.6,p)&&(pb=Gn(D,C,p,x,e),pb<x&&(x=pb,m=!0))}qa=ia[6];ia=ia[7];break;default:v("Unknown Segment type: "+P)}r=qa;
q=ia;Aa&&(Aa=Gn(D,C,p,x,e),Aa<x&&(x=Aa,m=!0));W.isClosed&&(qa=S,ia=T,Fn(r,q,qa,ia,D,C,h,k,p)&&(W=Gn(D,C,p,x,e),W<x&&(x=W,m=!0)))}}f=c-a;g=d-b;h=Math.sqrt(f*f+g*g);0!==h&&(f/=h,g/=h);e.x-=f*n;e.y-=g*n;K.free(p)}else v("Unknown Geometry type: "+l.type);if(!m)return!1;this.transform.Ga(e);return!0};function Gn(a,b,c,d,e){a=c.x-a;b=c.y-b;b=a*a+b*b;return b<d?(e.x=c.x,e.y=c.y,b):d}
function Fn(a,b,c,d,e,f,g,h,k){var l=!1,m=(e-g)*(b-d)-(f-h)*(a-c);if(0===m)return!1;k.x=((e*h-f*g)*(a-c)-(e-g)*(a*d-b*c))/m;k.y=((e*h-f*g)*(b-d)-(f-h)*(a*d-b*c))/m;(a>c?a-c:c-a)<(b>d?b-d:d-b)?(a=b<d?b:d,b=b<d?d:b,(k.y>a||L.da(k.y,a))&&(k.y<b||L.da(k.y,b))&&(l=!0)):(b=a<c?a:c,a=a<c?c:a,(k.x>b||L.da(k.x,b))&&(k.x<a||L.da(k.x,a))&&(l=!0));return l}
t.Lh=function(a,b){if(void 0===b)return a.Te(this.actualBounds);var c=this.sa;null===c&&(this.measure(Infinity,Infinity),c=this.sa);c=c.bounds;var d=this.strokeWidth/2,e=!1,f=K.alloc();f.h(c.x-d,c.y-d);a.ca(b.Ga(f))&&(f.h(c.x-d,c.bottom+d),a.ca(b.Ga(f))&&(f.h(c.right+d,c.bottom+d),a.ca(b.Ga(f))&&(f.h(c.right+d,c.y-d),a.ca(b.Ga(f))&&(e=!0))));K.free(f);return e};
t.Sc=function(a,b){if(this.Lh(a,b)||void 0===b&&(b=this.transform,a.Te(this.actualBounds)))return!0;var c=Jb.alloc();c.set(b);c.Ns();var d=a.left,e=a.right,f=a.top;a=a.bottom;var g=K.alloc();g.h(d,f);c.Ga(g);if(this.Mh(g,!0))return K.free(g),!0;g.h(e,f);c.Ga(g);if(this.Mh(g,!0))return K.free(g),!0;g.h(d,a);c.Ga(g);if(this.Mh(g,!0))return K.free(g),!0;g.h(e,a);c.Ga(g);if(this.Mh(g,!0))return K.free(g),!0;var h=K.alloc(),k=K.alloc();c.set(b);c.zv(this.transform);c.Ns();h.x=e;h.y=f;h.transform(c);g.x=
d;g.y=f;g.transform(c);b=!1;Hn(this,g,h,k)?b=!0:(g.x=e,g.y=a,g.transform(c),Hn(this,g,h,k)?b=!0:(h.x=d,h.y=a,h.transform(c),Hn(this,g,h,k)?b=!0:(g.x=d,g.y=f,g.transform(c),Hn(this,g,h,k)&&(b=!0))));K.free(g);Jb.free(c);K.free(h);K.free(k);return b};function Hn(a,b,c,d){if(!a.Is(b,c,d))return!1;a=b.x;b=b.y;var e=c.x,f=c.y;c=d.x;d=d.y;if(a===e)return b<f?(a=b,b=f):a=f,d>=a&&d<=b;a<e?(d=a,a=e):d=e;return c>=d&&c<=a}
t.ey=function(a,b,c){function d(a,b){for(var c=a.length,d=0;d<c;d+=2)if(b.wd(a[d],a[d+1])>e)return!0;return!1}if(c&&null!==this.fill&&this.Mh(a,!0))return!0;var e=a.Jf(b),f=e;1.5<this.strokeWidth&&(e=this.strokeWidth/2+Math.sqrt(e),e*=e);b=this.sa;if(null===b&&(this.measure(Infinity,Infinity),b=this.sa,null===b))return!1;if(!c){var g=b.bounds,h=g.x,k=g.y,l=g.x+g.width;g=g.y+g.height;if(Mb(a.x,a.y,h,k)<=e&&Mb(a.x,a.y,l,k)<=e&&Mb(a.x,a.y,h,g)<=e&&Mb(a.x,a.y,l,g)<=e)return!0}h=b.startX;k=b.startY;l=
b.endX;g=b.endY;if(b.type===N.j){if(c=Lb(a.x,a.y,h,k,l,g),b=(h-l)*(a.x-l)+(k-g)*(a.y-g),c<=(0<=(l-h)*(a.x-h)+(g-k)*(a.y-k)&&0<=b?e:f))return!0}else{if(b.type===N.F)return b=!1,c&&(b=Lb(a.x,a.y,h,k,h,g)<=e||Lb(a.x,a.y,h,k,l,k)<=e||Lb(a.x,a.y,l,k,l,g)<=e||Lb(a.x,a.y,h,g,l,g)<=e),b;if(b.type===N.O){b=a.x-(h+l)/2;f=a.y-(k+g)/2;var m=Math.abs(l-h)/2,n=Math.abs(g-k)/2;if(0===m||0===n)return Lb(a.x,a.y,h,k,l,g)<=e?!0:!1;if(c){if(a=L.Oz(m,n,b,f),a*a<=e)return!0}else return Mb(b,f,-m,0)>=e||Mb(b,f,0,-n)>=
e||Mb(b,f,0,n)>=e||Mb(b,f,m,0)>=e?!1:!0}else if(b.type===N.o){l=b.bounds;f=l.x;h=l.y;k=l.x+l.width;l=l.y+l.height;if(a.x>k&&a.x<f&&a.y>l&&a.y<h&&Lb(a.x,a.y,f,h,f,l)>e&&Lb(a.x,a.y,f,h,k,h)>e&&Lb(a.x,a.y,k,l,f,l)>e&&Lb(a.x,a.y,k,l,k,h)>e)return!1;f=Math.sqrt(e);if(c){if(null===this.fill?je(b,a.x,a.y,f):he(b,a,f,!0,!1))return!0}else{c=b.figures;for(b=0;b<c.count;b++){f=c.m[b];g=f.startX;m=f.startY;if(a.wd(g,m)>e)return!1;h=f.segments.m;k=h.length;for(l=0;l<k;l++)switch(n=h[l],n.type){case Qd:case Dd:g=
n.endX;m=n.endY;if(a.wd(g,m)>e)return!1;break;case Rd:var p=Na();L.Se(g,m,n.point1X,n.point1Y,n.point2X,n.point2Y,n.endX,n.endY,.8,p);g=d(p,a);Pa(p);if(g)return!1;g=n.endX;m=n.endY;if(a.wd(g,m)>e)return!1;break;case Sd:p=Na();L.yq(g,m,n.point1X,n.point1Y,n.endX,n.endY,.8,p);g=d(p,a);Pa(p);if(g)return!1;g=n.endX;m=n.endY;if(a.wd(g,m)>e)return!1;break;case Td:case ee:p=n.type===Td?fe(n,f):ge(n,f,g,m);var r=p.length;if(0===r){g=n.type===Td?n.centerX:n.endX;m=n.type===Td?n.centerY:n.endY;if(a.wd(g,m)>
e)return!1;break}n=null;for(var q=Na(),u=0;u<r;u++)if(n=p[u],q.length=0,L.Se(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],.8,q),d(q,a))return Pa(q),!1;Pa(q);null!==n&&(g=n[6],m=n[7]);break;default:v("Unknown Segment type: "+n.type)}}return!0}}}return!1};t.lc=function(){this.sa=null};t.$w=function(){return this.tg};
function In(a){var b=a.diagram;null!==b&&b.undoManager.isUndoingRedoing||(a.segmentOrientation=an,"None"!==a.cm?(a.segmentIndex=-1,a.alignmentFocus=md):"None"!==a.gl&&(a.segmentIndex=0,a.alignmentFocus=new Ib(1-md.x,md.y)))}
Kf.makeGeometry=function(a,b,c){if("None"!==a.toArrow)var d=Jn[a.toArrow];else"None"!==a.fromArrow?d=Jn[a.fromArrow]:(d=L.se[a.figure],"string"===typeof d&&(d=L.se[d]),void 0===d&&v("Unknown Shape.figure: "+a.figure),d=d(a,b,c),d.nl=b,d.ml=c);if(null===d){var e=L.se.Rectangle;"function"===typeof e&&(d=e(a,b,c))}G&&(d.bounds.width>b+1E-5||d.bounds.height>c+1E-5)&&v('Geometry made with figure "'+a.figure+'" has bounds '+d.bounds.toString()+" that are too large for the given size ("+b+","+c+"). See documentation for Shape.defineFigureGenerator.");
return d};function Kn(a){var b=Jn[a];if(void 0===b){var c=a.toLowerCase();if("none"===c)return"None";b=Jn[c];if(void 0===b){var d=null,e;for(e in L.Tm)if(e.toLowerCase()===c){d=e;break}if(null!==d)return a=N.parse(L.Tm[d],!1),Jn[d]=a,c!==d&&(Jn[c]=d),d}}return"string"===typeof b?b:b instanceof N?a:null}
na.Object.defineProperties(Kf.prototype,{geometry:{configurable:!0,get:function(){return null!==this.sa?this.sa:this.Kd},set:function(a){var b=this.sa,c=this.Kd;if(b!==a){null!==a?(G&&w(a,N,Kf,"geometry"),this.Kd=this.sa=a.freeze()):this.Kd=this.sa=null;var d=this.part;null!==d&&(d.ig=NaN);this.v();this.g("geometry",b||c,a);ml(this)&&(a=this.part,null!==a&&nl(this,a,"geometryString"))}}},geometryString:{configurable:!0,get:function(){return null===this.geometry?"":this.geometry.toString()},
set:function(a){a=N.parse(a);var b=a.normalize();this.geometry=a;this.position=a=K.allocAt(-b.x,-b.y);K.free(a)}},isGeometryPositioned:{configurable:!0,get:function(){return this.fo},set:function(a){G&&A(a,"boolean",Kf,"isGeometryPositioned");var b=this.fo;b!==a&&(this.fo=a,this.v(),this.g("isGeometryPositioned",b,a))}},fill:{configurable:!0,get:function(){return this.el},set:function(a){var b=this.el;b!==a&&(null!==a&&Wl(a,"Shape.fill"),a instanceof vl&&a.freeze(),this.el=
a,this.R(),this.g("fill",b,a))}},stroke:{configurable:!0,get:function(){return this.Nc},set:function(a){var b=this.Nc;b!==a&&(null!==a&&Wl(a,"Shape.stroke"),a instanceof vl&&a.freeze(),this.Nc=a,this.R(),this.g("stroke",b,a))}},strokeWidth:{configurable:!0,get:function(){return this.tg},set:function(a){var b=this.tg;if(b!==a)if(G&&E(a,Kf,"strokeWidth"),0<=a){this.tg=a;this.v();var c=this.part;null!==c&&(c.ig=NaN);this.g("strokeWidth",b,a)}else Ba(a,"value >= 0",Kf,"strokeWidth:value")}},
strokeCap:{configurable:!0,get:function(){return this.Wl},set:function(a){var b=this.Wl;b!==a&&("string"!==typeof a||"butt"!==a&&"round"!==a&&"square"!==a?Ba(a,'"butt", "round", or "square"',Kf,"strokeCap"):(this.Wl=a,this.R(),this.g("strokeCap",b,a)))}},strokeJoin:{configurable:!0,get:function(){return this.Xl},set:function(a){var b=this.Xl;b!==a&&("string"!==typeof a||"miter"!==a&&"bevel"!==a&&"round"!==a?Ba(a,'"miter", "bevel", or "round"',Kf,"strokeJoin"):(this.Xl=
a,this.R(),this.g("strokeJoin",b,a)))}},strokeMiterLimit:{configurable:!0,get:function(){return this.Uj},set:function(a){var b=this.Uj;if(b!==a)if(G&&E(a,Kf,"strokeMiterLimit"),1<=a){this.Uj=a;this.R();var c=this.part;null!==c&&(c.ig=NaN);this.g("strokeMiterLimit",b,a)}else G&&Ba(a,"value >= 1",Kf,"strokeWidth:value")}},strokeDashArray:{configurable:!0,get:function(){return this.xh},set:function(a){var b=this.xh;if(b!==a){null===a||Array.isArray(a)||za(a,"Array",Kf,"strokeDashArray:value");
if(null!==a){for(var c=a.length,d=0,e=0;e<c;e++){var f=a[e];(!G||"number"===typeof f)&&0<=f&&isFinite(f)||v("strokeDashArray:value "+f+" at index "+e+" must be a positive number or zero.");d+=f}if(0===d){if(null===b)return;a=null}}this.xh=a;this.R();this.g("strokeDashArray",b,a)}}},strokeDashOffset:{configurable:!0,get:function(){return this.yh},set:function(a){var b=this.yh;b!==a&&(G&&E(a,Kf,"strokeDashOffset"),0<=a&&(this.yh=a,this.R(),this.g("strokeDashOffset",b,a)))}},figure:{configurable:!0,
enumerable:!0,get:function(){return this.Jn},set:function(a){var b=this.Jn;if(b!==a){G&&A(a,"string",Kf,"figure");var c=L.se[a];"function"===typeof c?c=a:(c=L.se[a.toLowerCase()])||v("Unknown Shape.figure: "+a);b!==c&&(a=this.part,null!==a&&(a.ig=NaN),this.Jn=c,this.Kd=null,this.lc(),this.v(),this.g("figure",b,c))}}},toArrow:{configurable:!0,get:function(){return this.cm},set:function(a){var b=this.cm;!0===a?a="Standard":!1===a&&(a="");if(b!==a){G&&A(a,"string",Kf,"toArrow");var c=Kn(a);
null===c?v("Unknown Shape.toArrow: "+a):b!==c&&(this.cm=c,this.Kd=null,this.lc(),this.v(),In(this),this.g("toArrow",b,c))}}},fromArrow:{configurable:!0,get:function(){return this.gl},set:function(a){var b=this.gl;!0===a?a="Standard":!1===a&&(a="");if(b!==a){G&&A(a,"string",Kf,"fromArrow");var c=Kn(a);null===c?v("Unknown Shape.fromArrow: "+a):b!==c&&(this.gl=c,this.Kd=null,this.lc(),this.v(),In(this),this.g("fromArrow",b,c))}}},spot1:{configurable:!0,get:function(){return this.zf},
set:function(a){w(a,Ib,Kf,"spot1");var b=this.zf;b.B(a)||(this.zf=a=a.L(),this.v(),this.g("spot1",b,a))}},spot2:{configurable:!0,get:function(){return this.Af},set:function(a){w(a,Ib,Kf,"spot2");var b=this.Af;b.B(a)||(this.Af=a=a.L(),this.v(),this.g("spot2",b,a))}},parameter1:{configurable:!0,get:function(){return this.Xo},set:function(a){var b=this.Xo;b!==a&&(this.Xo=a,this.lc(),this.v(),this.g("parameter1",b,a))}},parameter2:{configurable:!0,get:function(){return this.Yo},
set:function(a){var b=this.Yo;b!==a&&(this.Yo=a,this.lc(),this.v(),this.g("parameter2",b,a))}},naturalBounds:{configurable:!0,get:function(){var a=this.desiredSize;return a.s()||null===this.sa?new M(0,0,a.width,a.height):(this.Ac.assign(this.sa.bounds),this.Ac)}},pathPattern:{configurable:!0,get:function(){return this.$o},set:function(a){var b=this.$o;b!==a&&(G&&null!==a&&w(a,O,Kf,"pathPattern"),this.$o=a,this.R(),this.g("pathPattern",b,a))}},geometryStretch:{configurable:!0,
enumerable:!0,get:function(){return this.Qn},set:function(a){var b=this.Qn;b!==a&&(db(a,O,Kf,"geometryStretch"),this.Qn=a,this.v(),this.g("geometryStretch",b,a))}},interval:{configurable:!0,get:function(){return this.ee},set:function(a){var b=this.ee;G&&E(a,Kf,"interval");a=Math.round(a);if(b!==a&&0!==a&&isFinite(a)){this.ee=a;var c=this.diagram;null!==c&&this.panel===c.grid&&rj(c);this.v();c=this.panel;null!==c&&(c.cg=null);this.g("interval",b,a)}}},graduatedStart:{configurable:!0,
enumerable:!0,get:function(){return this.ce},set:function(a){var b=this.ce;G&&E(a,Kf,"graduatedStart");b!==a&&(0>a?a=0:1<a&&(a=1),this.ce=a,this.v(),this.g("graduatedStart",b,a))}},graduatedEnd:{configurable:!0,get:function(){return this.ae},set:function(a){var b=this.ae;G&&E(a,Kf,"graduatedEnd");b!==a&&(0>a?a=0:1<a&&(a=1),this.ae=a,this.v(),this.g("graduatedEnd",b,a))}},graduatedSkip:{configurable:!0,get:function(){return this.be},set:function(a){var b=this.be;b!==a&&
(null!==a&&A(a,"function",Kf,"graduatedSkip"),this.be=a,this.v(),this.g("graduatedSkip",b,a))}}});Kf.prototype.intersectsRect=Kf.prototype.Sc;Kf.prototype.containedInRect=Kf.prototype.Lh;Kf.prototype.getNearestIntersectionPoint=Kf.prototype.Is;Kf.prototype.getDocumentBounds=Kf.prototype.Wi;Kf.prototype.getDocumentPoint=Kf.prototype.ja;var Jn=new fb,En=new fb;Kf.className="Shape";Kf.getFigureGenerators=function(){var a=new yb,b;for(b in L.se)b!==b.toLowerCase()&&a.add(b,L.se[b]);a.freeze();return a};
Kf.defineFigureGenerator=function(a,b){A(a,"string",Kf,"defineFigureGenerator:name");"string"===typeof b?!G||""!==b&&L.se[b]||v("Shape.defineFigureGenerator synonym must not be empty or None or not a defined figure name: "+b):A(b,"function",Kf,"defineFigureGenerator:func");var c=a.toLowerCase();!G||""!==a&&a!==c||v("Shape.defineFigureGenerator name must not be empty or all-lower-case: "+a);var d=L.se;d[a]=b;d[c]=a};
Kf.getArrowheadGeometries=function(){var a=new yb;for(d in L.Tm)if(void 0===Jn[d]){var b=N.parse(L.Tm[d],!1);Jn[d]=b;b=d.toLowerCase();b!==d&&(Jn[b]=d)}for(var c in Jn)if(c!==c.toLowerCase()){var d=Jn[c];d instanceof N&&a.add(c,d)}a.freeze();return a};
Kf.defineArrowheadGeometry=function(a,b){A(a,"string",Kf,"defineArrowheadGeometry:name");"string"===typeof b?(A(b,"string",Kf,"defineArrowheadGeometry:pathstr"),b=N.parse(b,!1)):w(b,N,Kf,"defineArrowheadGeometry:pathstr");var c=a.toLowerCase();(G&&""===a||"none"===c||a===c)&&v("Shape.defineArrowheadGeometry name must not be empty or None or all-lower-case: "+a);var d=Jn;d[a]=b;d[c]=a};
function Yg(a,b){O.call(this);Un||(Vn=Wg?(new Ik(null)).context:null,Un=!0);this.bc="";this.Nc="black";this.Ae="13px sans-serif";this.Ei="start";this.$d=pg;this.Li=id;this.Aj=!0;this.li=this.mi=!1;this.lg=Wn;this.xg=Xn;this.Ir=this.xb=this.dd=0;this.bu=this.cu=null;this.Gn=!1;this.td=this.jn=this.Lp=this.Fi=this.Mp=null;this.yf=this.xf=0;this.ii=Yn;this.He=Infinity;this.pi=0;this.Be=null;this.Ne=0;this.ze=this.Xb=this.Jc=null;this.ee=1;this.ce=0;this.ae=1;this.be=this.tj=null;"string"===typeof a?
this.text=a:a&&Object.assign(this,a);b&&Object.assign(this,b);return this}ma(Yg,O);
Yg.prototype.cloneProtected=function(a){O.prototype.cloneProtected.call(this,a);a.bc=this.bc;a.Nc=this.Nc;a.Ae=this.Ae;a.Ei=this.Ei;a.$d=this.$d;a.Li=this.Li;a.Aj=this.Aj;a.mi=this.mi;a.li=this.li;a.lg=this.lg;a.xg=this.xg;a.dd=this.dd;a.Ir=this.Ir;a.xb=this.xb;a.cu=this.cu;a.bu=this.bu;a.Gn=this.Gn;a.Mp=this.Mp;a.Fi=this.Fi;a.Lp=this.Lp;a.jn=this.jn;a.td=this.td;a.xf=this.xf;a.yf=this.yf;a.ii=this.ii;a.He=this.He;a.Be=this.Be;a.Ne=this.Ne;a.Jc=this.Jc;a.Xb=this.Xb;a.ze=this.ze;a.pi=this.pi;a.ee=
this.ee;a.ce=this.ce;a.ae=this.ae;a.tj=this.tj;a.be=this.be};
function $m(a,b){a.H=b.H|6144;a.rb=b.opacity;a.Zb=b.background;a.pd=b.areaBackground;a.$c=b.desiredSize.L();a.kg=b.minSize.L();a.jg=b.maxSize.L();null!==b.Gb?a.Gb=b.Gb.copy():a.Gb=null;a.ya=b.scale;a.Eb=b.angle;a.Qe=b.stretch;a.gh=b.margin.L();a.Db=b.alignment.L();a.Ik=b.alignmentFocus.L();a.Ml=b.segmentFraction;a.Nl=b.segmentOffset.L();a.Ol=b.segmentOrientation;null!==b.hb&&(a.hb=b.hb.copy());a.Ql=b.shadowVisible;b instanceof Yg&&(a.bc=b.bc,a.Nc=b.Nc,a.Ae=b.Ae,a.Ei=b.Ei,a.$d=b.$d,a.Li=b.Li,a.Aj=
b.Aj,a.mi=b.mi,a.li=b.li,a.lg=b.lg,a.xg=b.xg,a.Be=null,a.xf=b.xf,a.yf=b.yf,a.He=b.He,a.pi=b.pi,a.ee=b.ee,a.ce=b.ce,a.ae=b.ae,a.tj=b.tj,a.be=b.be)}t=Yg.prototype;t.mb=function(a){a.classType===Yg?this.wrap=a:O.prototype.mb.call(this,a)};t.toString=function(){return 22<this.bc.length?'TextBlock("'+this.bc.substring(0,20)+'"...)':'TextBlock("'+this.bc+'")'};t.v=function(){O.prototype.v.call(this);this.bu=this.cu=null};
function Zn(a){Un||(Vn=Wg?(new Ik(null)).context:null,Un=!0);if(null===Vn)return!0;var b=Vn.font;if(a===b||"10px sans-serif"===a)return!0;Vn.font="10px sans-serif";Vn.font=a;var c=Vn.font;if("10px sans-serif"!==c)return Vn.font=b,!0;Vn.font="19px serif";var d=Vn.font;Vn.font=a;c=Vn.font;Vn.font=b;return c!==d}
t.Pi=function(a,b){if(null!==this.Nc&&0!==this.bc.length&&null!==this.Ae){var c=this.naturalBounds,d=this.actualBounds,e=c.width,f=c.height,g=$n(this),h=a.textAlign=this.Ei,k=b.jo;"start"===h?h=k?"right":"left":"end"===h&&(h=k?"left":"right");k=this.mi;var l=this.li;pi(this,a,this.Nc,!0,!1,c,d);(k||l)&&pi(this,a,this.Nc,!1,!1,c,d);d=0;c=!1;var m=this.ne,n=m.dx-(g*m.m21+m.dx);m=m.dy-(g*m.m22+m.dy);var p=b.scale;8>(n*n+m*m)*p*p&&(c=!0);b.$b!==a&&(c=!1);!1===b.Ve("textGreeking")&&(c=!1);b=this.xf;n=
this.yf;switch(this.flip){case hl:a.translate(e,0);a.scale(-1,1);break;case gl:a.translate(0,f);a.scale(1,-1);break;case il:a.translate(e,f),a.scale(-1,-1)}a.Ld();m=this.dd;p=(b+g+n)*m;f>p&&(d=this.Li,d=d.y*f-d.y*p+d.offsetY);if(1===m&&null!==this.ze)n=this.xb,n>e&&(n=e),this.Oi(this.ze,a,0,d+b,e,g,n,c,h,k,l);else if(null!==this.Jc&&null!==this.Xb)for(p=0;p<m;p++){var r=this.Jc[p];r>e&&(r=e);d+=b;this.Oi(this.Xb[p],a,0,d,e,g,r,c,h,k,l);d+=g+n}switch(this.flip){case hl:a.scale(-1,1);a.translate(-e,
0);break;case gl:a.scale(1,-1);a.translate(0,-f);break;case il:a.scale(-1,-1),a.translate(-e,-f)}}};
t.Oi=function(a,b,c,d,e,f,g,h,k,l,m){var n=0;h?("left"===k?n=0:"right"===k?n=e-g:"center"===k&&(n=(e-g)/2),b.fillRect(c+n,d+.25*f,g,1)):("left"===k?n=0:"right"===k?n=e:"center"===k&&(n=e/2),e=null!==ao?ao(this,f):.75*f,b.fillText(a,c+n,d+e),a=f/20|0,0===a&&(a=1),"right"===k?n-=g:"center"===k&&(n-=g/2),l&&(k=null!==bo?bo(this,f):.8*f,b.beginPath(),b.lineWidth=a,b.moveTo(c+n,d+k),b.lineTo(c+n+g,d+k),b.stroke()),m&&(b.beginPath(),b.lineWidth=a,d=d+f-f/2.2|0,0!==a%2&&(d+=.5),b.moveTo(c+n,d),b.lineTo(c+
n+g,d),b.stroke()))};
t.um=function(a,b,c,d){this.pi=a;var e=this.Ae;null!==Vn&&co!==e&&(co=Vn.font=e);this.xb=this.Ne=0;this.ze=this.Xb=this.Jc=this.Be=null;var f;if(isNaN(this.desiredSize.width)){e=this.bc.replace(/\r\n/g,"\n").replace(/\r/g,"\n");if(0===e.length)e=0;else if(this.isMultiline){for(var g=f=0,h=!1;!h;){var k=e.indexOf("\n",g);-1===k&&(k=e.length,h=!0);g=e.substr(g,k-g);this.ii===Yn&&(g=g.trim());f=Math.max(f,eo(g));g=k+1}e=f}else f=e.indexOf("\n",0),0<=f&&(e=e.substr(0,f)),e=eo(e);e=Math.min(e,a/this.scale);
e=Math.max(8,e)}else e=this.desiredSize.width;null!==this.panel&&(e=Math.min(e,this.panel.maxSize.width));f=fo(this,e);isNaN(this.desiredSize.height)?f=Math.min(f,b/this.scale):f=this.desiredSize.height;h=f;if(0!==this.xb&&null!==this.Jc&&null!==this.Xb&&this.lg===go&&(b=this.Ae,b=this.lg===go?ho(b):0,k=this.xf+this.yf,k=Math.max(0,$n(this)+k),h=Math.min(this.maxLines-1,Math.max(Math.floor(h/k+.01)-1,0)),!(h+1>=this.Xb.length))){k=this.Xb[h];for(b=Math.max(1,a-b);eo(k)>b&&1<k.length;)k=k.substr(0,
k.length-1);k+=io;b=eo(k);this.Xb[h]=k;this.Xb=this.Xb.slice(0,h+1);this.Jc[h]=b;this.Jc=this.Jc.slice(0,h+1);this.Ne=this.Xb.length;this.xb=Math.max(this.xb,b);this.dd=this.Ne;1===this.dd&&(this.ze=this.Xb[0])}if(this.wrap===jo||isNaN(this.desiredSize.width))e=isNaN(a)?this.xb:Math.min(a,this.xb),isNaN(this.desiredSize.width)&&(e=Math.max(8,e));e=Math.max(c,e);f=Math.max(d,f);ac(this.Ac,e,f);this.Ie(0,0,e,f)};t.Kh=function(a,b,c,d){sl(this,a,b,c,d)};
function ko(a,b,c){if(null===a.ze)a.ze=b,a.xb=c;else{if(null===a.Xb||null===a.Jc)a.Xb=[],a.Jc=[],a.Xb.push(a.ze),a.Jc.push(a.xb);a.Xb.push(b);a.Jc.push(c)}}
function lo(a,b,c,d){var e=a.ii===Yn;e&&(b=b.trim());var f=0,g=a.Ae,h=a.xf+a.yf;h=Math.max(0,$n(a)+h);var k=a.lg===go?ho(g):0;if(a.dd>=a.He)null!==d&&d.h(0,h);else if(g=b,a.xg===mo){a.Ne=1;var l=eo(b);if(0===k||l<=c)a.xb=Math.max(a.xb,l),ko(a,b,a.xb),null!==d&&d.h(l,h);else{f=no(a,g);g=g.substr(f.length);b=no(a,g);for(l=eo(f+b);0<b.length&&l<=c;)f+=b,g=g.substr(b.length),b=no(a,g),l=f+b,e&&(l=l.trim()),l=eo(l);e&&(b=b.trim());f+=b;for(c=Math.max(1,c-k);eo(f)>c&&1<f.length;)f=f.substr(0,f.length-1);
f+=io;var m=eo(f);a.xb=m;ko(a,f,m);null!==d&&d.h(m,h)}}else{k=0;0===g.length&&(k=1,ko(a,g,0));for(;0<g.length;){b=no(a,g);for(g=g.substr(b.length);eo(b)>c;){var n=1;l=eo(b.substr(0,n));for(m=0;l<=c;)n++,m=l,l=eo(b.substr(0,n));if(1===n){var p=l;f=Math.max(f,l)}else p=m,f=Math.max(f,m);n--;1>n&&(n=1);ko(a,b.substr(0,n),p);k++;b=b.substr(n);if(a.dd+k>a.He)break}m=no(a,g);for(l=eo(b+m);0<m.length&&l<=c;)b+=m,g=g.substr(m.length),m=no(a,g),l=b+m,e&&(l=l.trim()),l=eo(l);e&&(b=b.trim());if(""!==b&&("\u00ad"===
b[b.length-1]&&(b=b.substring(0,b.length-1)+"\u2010"),0===m.length?(n=l,f=Math.max(f,l)):(n=m=eo(b),f=Math.max(f,m)),ko(a,b,n),k++,a.dd+k>a.He))break}a.Ne=Math.min(a.He,k);a.xb=Math.max(a.xb,f);null!==d&&d.h(a.xb,h*a.Ne)}}function no(a,b){if(a.xg===oo)return b.substr(0,1);for(var c=b.length,d=0,e=po;d<c&&!e.test(b.charAt(d));)d++;for(a.ii===qo&&(c=Math.min(c,d+1));d<c&&e.test(b.charAt(d));)d++;return d>=b.length?b:b.substr(0,d)}function eo(a){return null===Vn?8*a.length:Vn.measureText(a).width}
function $n(a){if(null!==a.Be)return a.Be;var b=a.Ae;if(null===Vn){var c=16;return a.Be=c}void 0!==ro[b]&&5E3>so?c=ro[b]:(c=1.3*Vn.measureText("M").width,ro[b]=c,so++);return a.Be=c}function ho(a){if(null===Vn)return 6;if(void 0!==to[a]&&5E3>uo)var b=to[a];else b=Vn.measureText(io).width,to[a]=b,uo++;return b}
function fo(a,b){var c=a.bc.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),d=a.xf+a.yf;d=Math.max(0,$n(a)+d);if(0===c.length)return a.xb=0,a.dd=1,d;if(!a.isMultiline){var e=c.indexOf("\n",0);0<=e&&(c=c.substr(0,e))}e=0;for(var f=a.dd=0,g,h=!1;!h;){g=c.indexOf("\n",f);-1===g&&(g=c.length,h=!0);if(f<=g){f=c.substr(f,g-f);if(a.xg!==mo){a.Ne=0;var k=Hb.alloc();lo(a,f,b,k);e+=k.height;Hb.free(k);a.dd+=a.Ne}else lo(a,f,b,null),e+=d,a.dd++;a.dd===a.He&&(h=!0)}f=g+1}return a.Ir=e}
na.Object.defineProperties(Yg.prototype,{font:{configurable:!0,get:function(){return this.Ae},set:function(a){var b=this.Ae;b!==a&&(G&&(A(a,"string",Yg,"font"),Zn(a)||v('Not a valid font: "'+a+'"')),this.Ae=a,this.Be=null,this.v(),this.g("font",b,a))}},text:{configurable:!0,get:function(){return this.bc},set:function(a){var b=this.bc;null!==a&&void 0!==a?a=a.toString():a="";b!==a&&(this.bc=a,this.v(),this.g("text",b,a))}},textAlign:{configurable:!0,get:function(){return this.Ei},
set:function(a){var b=this.Ei;b!==a&&(G&&A(a,"string",Yg,"textAlign"),"start"===a||"end"===a||"left"===a||"right"===a||"center"===a?(this.Ei=a,this.R(),this.g("textAlign",b,a)):G&&Ba(a,'"start", "end", "left", "right", or "center"',Yg,"textAlign"))}},flip:{configurable:!0,get:function(){return this.$d},set:function(a){var b=this.$d;b!==a&&(db(a,O,Yg,"flip"),this.$d=a,this.R(),this.g("flip",b,a))}},verticalAlignment:{configurable:!0,get:function(){return this.Li},set:function(a){var b=
this.Li;b.B(a)||(G&&(w(a,Ib,Yg,"verticalAlignment"),a.ec()&&v("TextBlock.verticalAlignment for "+this+" must be a real Spot, not:"+a)),this.Li=a=a.L(),Il(this),this.g("verticalAlignment",b,a))}},naturalBounds:{configurable:!0,get:function(){if(!this.Ac.s()){var a=Hb.alloc();lo(this,this.bc,999999,a);var b=a.width;Hb.free(a);a=fo(this,b);var c=this.desiredSize;isNaN(c.width)||(b=c.width);isNaN(c.height)||(a=c.height);ac(this.Ac,b,a)}return this.Ac}},isMultiline:{configurable:!0,
get:function(){return this.Aj},set:function(a){var b=this.Aj;b!==a&&(G&&A(a,"boolean",Yg,"isMultiline"),this.Aj=a,this.v(),this.g("isMultiline",b,a))}},isUnderline:{configurable:!0,get:function(){return this.mi},set:function(a){var b=this.mi;b!==a&&(G&&A(a,"boolean",Yg,"isUnderline"),this.mi=a,this.R(),this.g("isUnderline",b,a))}},isStrikethrough:{configurable:!0,get:function(){return this.li},set:function(a){var b=this.li;b!==a&&(G&&A(a,"boolean",Yg,"isStrikethrough"),
this.li=a,this.R(),this.g("isStrikethrough",b,a))}},wrap:{configurable:!0,get:function(){return this.xg},set:function(a){var b=this.xg;b!==a&&(G&&db(a,Yg,Yg,"wrap"),this.xg=a,this.v(),this.g("wrap",b,a))}},overflow:{configurable:!0,get:function(){return this.lg},set:function(a){var b=this.lg;b!==a&&(G&&db(a,Yg,Yg,"overflow"),this.lg=a,this.v(),this.g("overflow",b,a))}},stroke:{configurable:!0,get:function(){return this.Nc},set:function(a){var b=this.Nc;b!==
a&&(null!==a&&Wl(a,"TextBlock.stroke"),a instanceof vl&&a.freeze(),this.Nc=a,this.R(),this.g("stroke",b,a))}},lineCount:{configurable:!0,get:function(){return this.dd}},lineHeight:{configurable:!0,get:function(){return $n(this)}},editable:{configurable:!0,get:function(){return this.Gn},set:function(a){var b=this.Gn;b!==a&&(G&&A(a,"boolean",Yg,"editable"),this.Gn=a,this.g("editable",b,a))}},textEditor:{configurable:!0,get:function(){return this.Mp},
set:function(a){var b=this.Mp;b!==a&&(!G||a instanceof Pe||v("TextBlock.textEditor must be an HTMLInfo."),this.Mp=a,this.g("textEditor",b,a))}},errorFunction:{configurable:!0,get:function(){return this.td},set:function(a){var b=this.td;b!==a&&(null!==a&&A(a,"function",Yg,"errorFunction"),this.td=a,this.g("errorFunction",b,a))}},interval:{configurable:!0,get:function(){return this.ee},set:function(a){var b=this.ee;G&&E(a,Yg,"interval");a=Math.round(a);if(b!==a&&0!==a&&isFinite(a)){this.ee=
a;this.v();var c=this.panel;null!==c&&(c.cg=null);this.g("interval",b,a)}}},graduatedStart:{configurable:!0,get:function(){return this.ce},set:function(a){var b=this.ce;G&&E(a,Yg,"graduatedStart");b!==a&&(0>a?a=0:1<a&&(a=1),this.ce=a,this.v(),this.g("graduatedStart",b,a))}},graduatedEnd:{configurable:!0,get:function(){return this.ae},set:function(a){var b=this.ae;G&&E(a,Yg,"graduatedEnd");b!==a&&(0>a?a=0:1<a&&(a=1),this.ae=a,this.v(),this.g("graduatedEnd",b,a))}},graduatedFunction:{configurable:!0,
enumerable:!0,get:function(){return this.tj},set:function(a){var b=this.tj;b!==a&&(null!==a&&A(a,"function",Yg,"graduatedFunction"),this.tj=a,this.v(),this.g("graduatedFunction",b,a))}},graduatedSkip:{configurable:!0,get:function(){return this.be},set:function(a){var b=this.be;b!==a&&(null!==a&&A(a,"function",Yg,"graduatedSkip"),this.be=a,this.v(),this.g("graduatedSkip",b,a))}},textValidation:{configurable:!0,get:function(){return this.Fi},set:function(a){var b=this.Fi;
b!==a&&(null!==a&&A(a,"function",Yg,"textValidation"),this.Fi=a,this.g("textValidation",b,a))}},textEdited:{configurable:!0,get:function(){return this.Lp},set:function(a){var b=this.Lp;b!==a&&(null!==a&&A(a,"function",Yg,"textEdited"),this.Lp=a,this.g("textEdited",b,a))}},spacingAbove:{configurable:!0,get:function(){return this.xf},set:function(a){var b=this.xf;b!==a&&(G&&A(a,"number",Yg,"spacingAbove"),this.xf=a,this.v(),this.g("spacingAbove",b,a))}},spacingBelow:{configurable:!0,
enumerable:!0,get:function(){return this.yf},set:function(a){var b=this.yf;b!==a&&(G&&A(a,"number",Yg,"spacingBelow"),this.yf=a,this.v(),this.g("spacingBelow",b,a))}},formatting:{configurable:!0,get:function(){return this.ii},set:function(a){var b=this.ii;b!==a&&(db(a,Yg,Yg,"flip"),this.ii=a,this.v(),this.g("formatting",b,a))}},maxLines:{configurable:!0,get:function(){return this.He},set:function(a){var b=this.He;b!==a&&(G&&A(a,"number",Yg,"maxLines"),a=Math.floor(a),0>=
a&&Ba(a,"> 0",Yg,"maxLines"),this.He=a,this.v(),this.g("maxLines",b,a))}},metrics:{configurable:!0,get:function(){return{arrSize:null!==this.Jc?this.Jc:[this.xb],arrText:null!==this.Xb?this.Xb:[this.ze],maxLineWidth:this.xb,fontHeight:this.Be}}},choices:{configurable:!0,get:function(){return this.jn},set:function(a){var b=this.jn;b!==a&&(G&&null!==a&&!Array.isArray(a)&&za(a,"Array",Yg,"choices:value"),this.jn=a,this.g("choices",b,a))}}});
var ao=null,bo=null,mo=new F(Yg,"None",0),jo=new F(Yg,"WrapFit",1),Xn=new F(Yg,"WrapDesiredSize",2),oo=new F(Yg,"WrapBreakAll",3),Wn=new F(Yg,"OverflowClip",0),go=new F(Yg,"OverflowEllipsis",1),Yn=new F(Yg,"FormatTrim",0),qo=new F(Yg,"FormatNone",0),po=/[ \u200b\u00ad]/,ro=new fb,so=0,to=new fb,uo=0,io="...",co="",Vn=null,Un=!1;Yg.className="TextBlock";Yg.getEllipsis=function(){return io};Yg.setEllipsis=function(a){io=a;to=new fb;uo=0};Yg.getBaseline=function(){return ao};
Yg.setBaseline=function(a){ao=a};Yg.getUnderline=function(){return bo};Yg.setUnderline=function(a){bo=a};Yg.isValidFont=Zn;Yg.None=mo;Yg.WrapFit=jo;Yg.WrapDesiredSize=Xn;Yg.WrapBreakAll=oo;Yg.OverflowClip=Wn;Yg.OverflowEllipsis=go;function ek(a,b){O.call(this);this.Xg=null;this.Fp="";this.wh=tc;this.il=Bd;this.zh=this.td=null;this.hl=Ic;this.$d=pg;this.Zl=null;this.eo=!1;this.fl=!0;this.xl=!1;this.Sl=null;"string"===typeof a?this.source=a:a&&Object.assign(this,a);b&&Object.assign(this,b)}var vo;
ma(ek,O);ek.prototype.cloneProtected=function(a){O.prototype.cloneProtected.call(this,a);a.element=this.Xg;a.Fp=this.Fp;a.wh=this.wh.L();a.il=this.il;a.$d=this.$d;a.td=this.td;a.zh=this.zh;a.hl=this.hl.L();a.fl=this.fl;a.Sl=this.Sl};ek.prototype.mb=function(a){a===pg||a===rg||a===fl?this.imageStretch=a:O.prototype.mb.call(this,a)};ek.prototype.toString=function(){return"Picture("+this.source+")#"+lb(this)};
function Ki(a){void 0===a&&(a="");A(a,"string",ek,"clearCache:url");""!==a?vo[a]&&(delete vo[a],wo--):(vo=new fb,wo=0)}
function xo(a,b){b.ez||(b.Hr=function(c){b.zr=!0;b.Yn=!1;var d=b.Tg.copy();if(null!==d&&void 0!==d){for(d=d.iterator;d.next();){var e=d.value;var f=b.getAttribute("src")||"";var g=e.ph.K(f);if(null!==g)for(var h=g.length,k=0;k<h;k++)f=g[k],e.ap.add(f),e.Lb(),b.Rn&&(void 0===b.ou&&(b.ou=c),null!==f.zh&&f.zh(f,c))}b.Tg.clear()}a.desiredSize.s()||(qj(a,!1),a.v())},b.kr=function(a){b.Yn=a;var c=b.Tg.copy();if(null!==c&&void 0!==c){for(c=c.iterator;c.next();){var e=c.value,f=b.getAttribute("src")||"";
var g=e.ph.K(f);if(null!==g){e=g.length;f=Na();for(var h=0;h<e;h++)f.push(g[h]);if(b.Rn)for(h=0;h<e;h++)g=f[h],null!==g.td&&g.td(g,a);Pa(f)}}b.Tg.clear()}},b.addEventListener("load",b.Hr),b.addEventListener("error",b.kr),b.ez=!0)}function gk(a){a.Hr&&a.removeEventListener("load",a.Hr);a.kr&&a.removeEventListener("error",a.kr);delete a.Hr;delete a.kr}ek.prototype.WA=function(){if(""!==this.source){Ki(this.source);var a=this.source;this.source="";this.source=a}};ek.prototype.redraw=function(){this.R()};
ek.prototype.Pi=function(a,b){var c=this.Xg;if(null!==c){var d=c.getAttribute("src");if(!(c instanceof HTMLImageElement&&(null===d||""===d)||c.Yn instanceof Event&&a instanceof Dl)){d=this.naturalBounds;var e=0,f=0,g=this.eo,h=g?+c.width:c.naturalWidth;g=g?+c.height:c.naturalHeight;void 0===h&&c.videoWidth&&(h=c.videoWidth);void 0===g&&c.videoHeight&&(g=c.videoHeight);h=h||d.width;g=g||d.height;if(0!==h&&0!==g){var k=h,l=g;this.sourceRect.s()&&(e=this.wh.x,f=this.wh.y,h=this.wh.width,g=this.wh.height);
var m=h,n=g,p=this.il,r=this.hl;switch(p){case pg:if(this.sourceRect.s())break;m>=d.width&&(e=e+r.offsetX+(m*r.x-d.width*r.x));n>=d.height&&(f=f+r.offsetY+(n*r.y-d.height*r.y));h=Math.min(d.width,m);g=Math.min(d.height,n);break;case Bd:m=d.width;n=d.height;break;case rg:case fl:p===rg?(p=Math.min(d.height/n,d.width/m),m*=p,n*=p):p===fl&&(p=Math.max(d.height/n,d.width/m),m*=p,n*=p,m>=d.width&&(e=(e+r.offsetX+(m*r.x-d.width*r.x)/m)*h),n>=d.height&&(f=(f+r.offsetY+(n*r.y-d.height*r.y)/n)*g),h*=1/(m/
d.width),g*=1/(n/d.height),m=d.width,n=d.height)}p=this.Mf()*b.scale;var q=m*p*n*p,u=h*g/q,x=c.__goCache;p=null;var y=yo;if(c.zr&&void 0!==x&&4<q&&u>y*y)for(null===x.Ni&&(zo(x,4,k,l,c),zo(x,16,k,l,c)),k=x.Ni,l=k.length,q=0;q<l;q++)if(k[q].ratio*k[q].ratio<u)p=k[q];else break;if(!b.Dn){if(null===this.Zl)if(null===this.Xg)this.Zl=!1;else{k=(new Ik(null)).context;k.drawImage(this.Xg,0,0);try{k.getImageData(0,0,1,1).data[3]&&(this.Zl=!1),this.Zl=!1}catch(z){this.Zl=!0}}if(this.Zl)return}k=0;m<d.width&&
(k=r.offsetX+(d.width*r.x-m*r.x));l=0;n<d.height&&(l=r.offsetY+(d.height*r.y-n*r.y));switch(this.flip){case hl:a.translate(Math.min(d.width,m),0);a.scale(-1,1);break;case gl:a.translate(0,Math.min(d.height,n));a.scale(1,-1);break;case il:a.translate(Math.min(d.width,m),Math.min(d.height,n)),a.scale(-1,-1)}a.Ld();if(b.Ve("pictureRatioOptimization")&&!b.zj&&void 0!==x&&null!==p&&1!==p.ratio){a.save();b=p.ratio;try{a.drawImage(p.source,e/b,f/b,Math.min(p.source.width,h/b),Math.min(p.source.height,g/
b),k,l,Math.min(d.width,m),Math.min(d.height,n))}catch(z){G&&this.fl&&Fa(z.toString()),this.fl=!1}a.restore()}else try{a.drawImage(c,e,f,h,g,k,l,Math.min(d.width,m),Math.min(d.height,n))}catch(z){G&&this.fl&&Fa(z.toString()),this.fl=!1}switch(this.flip){case hl:a.scale(-1,1);a.translate(-Math.min(d.width,m),0);break;case gl:a.scale(1,-1);a.translate(0,-Math.min(d.height,n));break;case il:a.scale(-1,-1),a.translate(-Math.min(d.width,m),-Math.min(d.height,n))}}}}};
ek.prototype.um=function(a,b,c,d){var e=this.desiredSize,f=ql(this,!0),g=this.Xg,h=this.eo;if(h||!this.xl&&g&&g.complete)this.xl=!0;null===g&&(isFinite(e.width)||(a=0),isFinite(e.height)||(b=0));isFinite(e.width)||f===Bd||f===dl?(isFinite(a)||(this.sourceRect.s()?a=this.sourceRect.width:null!==g&&(a=h?+g.width:g.naturalWidth)),c=0):null!==g&&!1!==this.xl&&(a=this.sourceRect.s()?this.sourceRect.width:h?+g.width:g.naturalWidth);isFinite(e.height)||f===Bd||f===el?(isFinite(b)||(this.sourceRect.s()?b=
this.sourceRect.height:null!==g&&(b=h?+g.height:g.naturalHeight)),d=0):null!==g&&!1!==this.xl&&(b=this.sourceRect.s()?this.sourceRect.height:h?+g.height:g.naturalHeight);isFinite(e.width)&&(a=e.width);isFinite(e.height)&&(b=e.height);e=this.maxSize;f=this.minSize;c=Math.max(c||0,f.width);d=Math.max(d||0,f.height);a=Math.min(e.width,a);b=Math.min(e.height,b);a=Math.max(c,a);b=Math.max(d,b);null===g||g.complete||(isFinite(a)||(a=0),isFinite(b)||(b=0));ac(this.Ac,a,b);this.Ie(0,0,a,b)};
ek.prototype.Kh=function(a,b,c,d){sl(this,a,b,c,d)};
na.Object.defineProperties(ek.prototype,{element:{configurable:!0,get:function(){return this.Xg},set:function(a){var b=this.Xg;if(b!==a){this.eo=a instanceof HTMLCanvasElement;var c=a instanceof HTMLImageElement;b instanceof HTMLImageElement&&gk(b);null===a||c||a instanceof HTMLVideoElement||this.eo||v("Picture.element must be an instance of Image, Canvas, or Video, not: "+a);var d=this.diagram;null!==d&&fk(d,this);this.Xg=a;null!==a&&c&&void 0===a.Tg&&(a.Tg=new I);null!==d&&c&&dk(d,
this);null!==a&&(this.eo||!0===a.complete?(a.Rn&&(a.Yn instanceof Event&&null!==this.td?this.td(this,a.Yn):!0===a.zr&&!a.Yn&&null!==this.zh&&a.ou&&this.zh(this,a.ou)),a.zr=!0,this.desiredSize.s()||(qj(this,!1),this.v())):c&&xo(this,a));this.g("element",b,a);this.R()}}},source:{configurable:!0,get:function(){return this.Fp},set:function(a){var b=this.Fp;if(b!==a){A(a,"string",ek,"source");this.Fp=a;var c=vo;if(Wg){if(void 0!==c[a])var d=c[a];else if(""!==a){30<wo&&(Ki(),c=vo);d=wa("img");
d.Rn=!0;xo(this,d);var e=this.Sl;null!==e&&(d.crossOrigin=e(this));d.src=a;c[a]=d;wo++}this.element=d;null!==d&&void 0===d.__goCache&&(d.__goCache=new Ao);this.v();this.R()}this.g("source",b,a)}}},sourceCrossOrigin:{configurable:!0,get:function(){return this.Sl},set:function(a){if(this.Sl!==a&&(null!==a&&A(a,"function",ek,"sourceCrossOrigin"),this.Sl=a,null!==this.element)){var b=this.element.getAttribute("src");null===a&&"string"===typeof b?this.element.crossOrigin=null:null!==a&&(this.element.crossOrigin=
a(this));this.element.src=b}}},sourceRect:{configurable:!0,get:function(){return this.wh},set:function(a){var b=this.wh;b.B(a)||(w(a,M,ek,"sourceRect"),this.wh=a=a.L(),this.R(),this.g("sourceRect",b,a))}},imageStretch:{configurable:!0,get:function(){return this.il},set:function(a){var b=this.il;b!==a&&(db(a,O,ek,"imageStretch"),this.il=a,this.R(),this.g("imageStretch",b,a))}},flip:{configurable:!0,get:function(){return this.$d},set:function(a){var b=this.$d;
b!==a&&(db(a,O,ek,"flip"),this.$d=a,this.R(),this.g("flip",b,a))}},imageAlignment:{configurable:!0,get:function(){return this.hl},set:function(a){w(a,Ib,ek,"imageAlignment");var b=this.hl;b.B(a)||(this.hl=a=a.L(),this.R(),this.g("imageAlignment",b,a))}},errorFunction:{configurable:!0,get:function(){return this.td},set:function(a){var b=this.td;b!==a&&(null!==a&&A(a,"function",ek,"errorFunction"),this.td=a,this.g("errorFunction",b,a))}},successFunction:{configurable:!0,
enumerable:!0,get:function(){return this.zh},set:function(a){var b=this.zh;b!==a&&(null!==a&&A(a,"function",ek,"successFunction"),this.zh=a,this.g("successFunction",b,a))}},naturalBounds:{configurable:!0,get:function(){return this.Ac}}});ek.prototype.redraw=ek.prototype.redraw;ek.prototype.reloadSource=ek.prototype.WA;var wo=0,yo=4;ek.className="Picture";vo=new fb;ek.clearCache=Ki;function Ao(){this.Ni=null}
function zo(a,b,c,d,e){null===a.Ni&&(a.Ni=[]);var f=new Ik(null),g=f.context,h=1/b;f.width=c/b;f.height=d/b;0!==f.width&&0!==f.height&&(b=new Bo(f.Qa,b),c=1,0<a.Ni.length&&(c=a.Ni[a.Ni.length-1],e=c.source,c=c.ratio),g.setTransform(h*c,0,0,h*c,0,0),g.Ld(),g.drawImage(e,0,0),a.Ni.push(b))}Ao.className="PictureCacheArray";function Bo(a,b){this.source=a;this.ratio=b}Bo.className="PictureCacheInstance";function Co(){this.Fs=new N;this.pc=null}
Co.prototype.reset=function(a){null!==a?(a.ka(),this.Fs=a,a.figures.clear()):this.Fs=new N;this.pc=null};function Fd(a,b,c,d,e){a.pc=new le;a.pc.startX=b;a.pc.startY=c;a.pc.isFilled=d;a.Fs.figures.add(a.pc);void 0!==e&&(a.pc.isShadowed=e)}function Jd(a){var b=a.pc.segments.length;0<b&&a.pc.segments.M(b-1).close()}Co.prototype.Nm=function(a){this.pc.isShadowed=a};Co.prototype.moveTo=function(a,b,c){void 0===c&&(c=!1);var d=new me(Qd);d.endX=a;d.endY=b;c&&d.close();this.pc.segments.add(d)};
Co.prototype.lineTo=function(a,b,c){void 0===c&&(c=!1);var d=new me(Dd);d.endX=a;d.endY=b;c&&d.close();this.pc.segments.add(d)};function Gd(a,b,c,d,e,f,g){var h;void 0===h&&(h=!1);var k=new me(Rd);k.point1X=b;k.point1Y=c;k.point2X=d;k.point2Y=e;k.endX=f;k.endY=g;h&&k.close();a.pc.segments.add(k)}function Hd(a,b,c,d,e){var f;void 0===f&&(f=!1);var g=new me(Sd);g.point1X=b;g.point1Y=c;g.endX=d;g.endY=e;f&&g.close();a.pc.segments.add(g)}
Co.prototype.arcTo=function(a,b,c,d,e,f,g){void 0===f&&(f=0);void 0===g&&(g=!1);var h=new me(Td);h.startAngle=a;h.sweepAngle=b;h.centerX=c;h.centerY=d;h.radiusX=e;h.radiusY=0!==f?f:e;g&&h.close();this.pc.segments.add(h)};function Id(a,b,c,d,e,f,g,h){var k;void 0===k&&(k=!1);b=new me(ee,g,h,b,c,d,e,f);k&&b.close();a.pc.segments.add(b)}function Ed(a){var b=Od;if(null!==b)return Od=null,b.reset(a),b;b=new Co;b.reset(a);return b}var Od=null;Co.className="StreamGeometryContext";
function Do(a,b){var c=a.toLowerCase(),d=L.se;d[a]=b;d[c]=a}Do("Rectangle",function(a,b,c){a="r"+b+","+c;var d=L.Vf[a];if(void 0!==d)return d;d=new N(N.F);d.endX=b;d.endY=c;L.Wf<L.Um&&(L.Vf[a]=d,L.Wf++);return d});Do("Square",function(a,b,c){a="s"+b+","+c;var d=L.Vf[a];if(void 0!==d)return d;d=new N(N.F);d.endX=b;d.endY=c;d.defaultStretch=rg;L.Wf<L.Um&&(L.Vf[a]=d,L.Wf++);return d});
Do("RoundedRectangle",function(a,b,c){a=a?a.parameter1:NaN;if(isNaN(a)||0>a)a=5;a=Math.min(a,b/3);a=Math.min(a,c/3);var d="rr"+b+","+c+","+a,e=L.Vf[d];if(void 0!==e)return e;var f=a*L.Hg;e=(new N).add((new le(a,0,!0)).add(new me(Dd,b-a,0)).add(new me(Rd,b,a,b-f,0,b,f)).add(new me(Dd,b,c-a)).add(new me(Rd,b-a,c,b,c-f,b-f,c)).add(new me(Dd,a,c)).add(new me(Rd,0,c-a,f,c,0,c-f)).add(new me(Dd,0,a)).add((new me(Rd,a,0,0,f,f,0)).close()));1<f&&(e.spot1=new Ib(0,0,f,f),e.spot2=new Ib(1,1,-f,-f));L.Wf<L.Um&&
(L.Vf[d]=e,L.Wf++);return e});Do("Border","RoundedRectangle");Do("Ellipse",function(a,b,c){a="e"+b+","+c;var d=L.Vf[a];if(void 0!==d)return d;d=new N(N.O);d.endX=b;d.endY=c;d.spot1=od;d.spot2=pd;L.Wf<L.Um&&(L.Vf[a]=d,L.Wf++);return d});Do("Circle",function(a,b,c){a="c"+b+","+c;var d=L.Vf[a];if(void 0!==d)return d;d=new N(N.O);d.endX=b;d.endY=c;d.spot1=od;d.spot2=pd;d.defaultStretch=rg;L.Wf<L.Um&&(L.Vf[a]=d,L.Wf++);return d});
Do("TriangleRight",function(a,b,c){return(new N).add((new le(0,0)).add(new me(Dd,b,.5*c)).add((new me(Dd,0,c)).close())).Om(0,.25,.5,.75)});Do("TriangleDown",function(a,b,c){return(new N).add((new le(0,0)).add(new me(Dd,b,0)).add((new me(Dd,.5*b,c)).close())).Om(.25,0,.75,.5)});Do("TriangleLeft",function(a,b,c){return(new N).add((new le(b,c)).add(new me(Dd,0,.5*c)).add((new me(Dd,b,0)).close())).Om(.5,.25,1,.75)});
Do("TriangleUp",function(a,b,c){return(new N).add((new le(b,c)).add(new me(Dd,0,c)).add((new me(Dd,.5*b,0)).close())).Om(.25,.5,.75,1)});Do("Triangle","TriangleUp");Do("Diamond",function(a,b,c){return(new N).add((new le(.5*b,0)).add(new me(Dd,0,.5*c)).add(new me(Dd,.5*b,c)).add((new me(Dd,b,.5*c)).close())).Om(.25,.25,.75,.75)});Do("LineH",function(a,b,c){a=new N(N.j);a.startX=0;a.startY=c/2;a.endX=b;a.endY=c/2;return a});
Do("LineV",function(a,b,c){a=new N(N.j);a.startX=b/2;a.startY=0;a.endX=b/2;a.endY=c;return a});Do("None","Rectangle");Do("BarH","Rectangle");Do("BarV","Rectangle");Do("MinusLine","LineH");Do("PlusLine",function(a,b,c){return(new N).add((new le(0,c/2,!1)).add(new me(Dd,b,c/2)).add(new me(Qd,b/2,0)).add(new me(Dd,b/2,c)))});Do("XLine",function(a,b,c){return(new N).add((new le(0,c,!1)).add(new me(Dd,b,0)).add(new me(Qd,0,0)).add(new me(Dd,b,c)))});
L.Tm={"":"",Standard:"F1 m 0,0 l 8,4 -8,4 2,-4 z",Backward:"F1 m 8,0 l -2,4 2,4 -8,-4 z",Triangle:"F1 m 0,0 l 8,4.62 -8,4.62 z",BackwardTriangle:"F1 m 8,4 l 0,4 -8,-4 8,-4 0,4 z",Boomerang:"F1 m 0,0 l 8,4 -8,4 4,-4 -4,-4 z",BackwardBoomerang:"F1 m 8,0 l -8,4 8,4 -4,-4 4,-4 z",SidewaysV:"m 0,0 l 8,4 -8,4 0,-1 6,-3 -6,-3 0,-1 z",BackwardV:"m 8,0 l -8,4 8,4 0,-1 -6,-3 6,-3 0,-1 z",OpenTriangle:"m 0,0 l 8,4 -8,4",BackwardOpenTriangle:"m 8,0 l -8,4 8,4",OpenTriangleLine:"m 0,0 l 8,4 -8,4 m 8.5,0 l 0,-8",
BackwardOpenTriangleLine:"m 8,0 l  -8,4 8,4 m -8.5,0 l 0,-8",OpenTriangleTop:"m 0,0 l 8,4 m 0,4",BackwardOpenTriangleTop:"m 8,0 l -8,4 m 0,4",OpenTriangleBottom:"m 0,8 l 8,-4",BackwardOpenTriangleBottom:"m 0,4 l 8,4",HalfTriangleTop:"F1 m 0,0 l 0,4 8,0 z m 0,8",BackwardHalfTriangleTop:"F1 m 8,0 l 0,4 -8,0 z m 0,8",HalfTriangleBottom:"F1 m 0,4 l 0,4 8,-4 z",BackwardHalfTriangleBottom:"F1 m 8,4 l 0,4 -8,-4 z",ForwardSemiCircle:"m 4,0 b 270 180 0 4 4",BackwardSemiCircle:"m 4,8 b 90 180 0 -4 4",Feather:"m 0,0 l 3,4 -3,4",
BackwardFeather:"m 3,0 l -3,4 3,4",DoubleFeathers:"m 0,0 l 3,4 -3,4 m 3,-8 l 3,4 -3,4",BackwardDoubleFeathers:"m 3,0 l -3,4 3,4 m 3,-8 l -3,4 3,4",TripleFeathers:"m 0,0 l 3,4 -3,4 m 3,-8 l 3,4 -3,4 m 3,-8 l 3,4 -3,4",BackwardTripleFeathers:"m 3,0 l -3,4 3,4 m 3,-8 l -3,4 3,4 m 3,-8 l -3,4 3,4",ForwardSlash:"m 0,8 l 5,-8",BackSlash:"m 0,0 l 5,8",DoubleForwardSlash:"m 0,8 l 4,-8 m -2,8 l 4,-8",DoubleBackSlash:"m 0,0 l 4,8 m -2,-8 l 4,8",TripleForwardSlash:"m 0,8 l 4,-8 m -2,8 l 4,-8 m -2,8 l 4,-8",
TripleBackSlash:"m 0,0 l 4,8 m -2,-8 l 4,8 m -2,-8 l 4,8",Fork:"m 0,4 l 8,0 m -8,0 l 8,-4 m -8,4 l 8,4",BackwardFork:"m 8,4 l -8,0 m 8,0 l -8,-4 m 8,4 l -8,4",LineFork:"m 0,0 l 0,8 m 0,-4 l 8,0 m -8,0 l 8,-4 m -8,4 l 8,4",BackwardLineFork:"m 8,4 l -8,0 m 8,0 l -8,-4 m 8,4 l -8,4 m 8,-8 l 0,8",CircleFork:"F1 m 6,4 b 0 360 -3 0 3 z m 0,0 l 6,0 m -6,0 l 6,-4 m -6,4 l 6,4",BackwardCircleFork:"F1 m 0,4 l 6,0 m -6,-4 l 6,4 m -6,4 l 6,-4 m 6,0 b 0 360 -3 0 3",CircleLineFork:"F1 m 6,4 b 0 360 -3 0 3 z m 1,-4 l 0,8 m 0,-4 l 6,0 m -6,0 l 6,-4 m -6,4 l 6,4",
BackwardCircleLineFork:"F1 m 0,4 l 6,0 m -6,-4 l 6,4 m -6,4 l 6,-4 m 0,-4 l 0,8 m 7,-4 b 0 360 -3 0 3",Circle:"F1 m 8,4 b 0 360 -4 0 4 z",Block:"F1 m 0,0 l 0,8 8,0 0,-8 z",StretchedDiamond:"F1 m 0,3 l 5,-3 5,3 -5,3 -5,-3 z",Diamond:"F1 m 0,4 l 4,-4 4,4 -4,4 -4,-4 z",Chevron:"F1 m 0,0 l 5,0 3,4 -3,4 -5,0 3,-4 -3,-4 z",StretchedChevron:"F1 m 0,0 l 8,0 3,4 -3,4 -8,0 3,-4 -3,-4 z",NormalArrow:"F1 m 0,2 l 4,0 0,-2 4,4 -4,4 0,-2 -4,0 z",X:"m 0,0 l 8,8 m 0,-8 l -8,8",TailedNormalArrow:"F1 m 0,0 l 2,0 1,2 3,0 0,-2 2,4 -2,4 0,-2 -3,0 -1,2 -2,0 1,-4 -1,-4 z",
DoubleTriangle:"F1 m 0,0 l 4,4 -4,4 0,-8 z  m 4,0 l 4,4 -4,4 0,-8 z",BigEndArrow:"F1 m 0,0 l 5,2 0,-2 3,4 -3,4 0,-2 -5,2 0,-8 z",ConcaveTailArrow:"F1 m 0,2 h 4 v -2 l 4,4 -4,4 v -2 h -4 l 2,-2 -2,-2 z",RoundedTriangle:"F1 m 0,1 a 1,1 0 0 1 1,-1 l 7,3 a 0.5,1 0 0 1 0,2 l -7,3 a 1,1 0 0 1 -1,-1 l 0,-6 z",SimpleArrow:"F1 m 1,2 l -1,-2 2,0 1,2 -1,2 -2,0 1,-2 5,0 0,-2 2,2 -2,2 0,-2 z",AccelerationArrow:"F1 m 0,0 l 0,8 0.2,0 0,-8 -0.2,0 z m 2,0 l 0,8 1,0 0,-8 -1,0 z m 3,0 l 2,0 2,4 -2,4 -2,0 0,-8 z",BoxArrow:"F1 m 0,0 l 4,0 0,2 2,0 0,-2 2,4 -2,4 0,-2 -2,0 0,2 -4,0 0,-8 z",
TriangleLine:"F1 m 8,4 l -8,-4 0,8 8,-4 z m 0.5,4 l 0,-8",CircleEndedArrow:"F1 m 10,4 l -2,-3 0,2 -2,0 0,2 2,0 0,2 2,-3 z m -4,0 b 0 360 -3 0 3 z",DynamicWidthArrow:"F1 m 0,3 l 2,0 2,-1 2,-2 2,4 -2,4 -2,-2 -2,-1 -2,0 0,-2 z",EquilibriumArrow:"m 0,3 l 8,0 -3,-3 m 3,5 l -8,0 3,3",FastForward:"F1 m 0,0 l 3.5,4 0,-4 3.5,4 0,-4 1,0 0,8 -1,0 0,-4 -3.5,4 0,-4 -3.5,4 0,-8 z",Kite:"F1 m 0,4 l 2,-4 6,4 -6,4 -2,-4 z",HalfArrowTop:"F1 m 0,0 l 4,4 4,0 -8,-4 z m 0,8",HalfArrowBottom:"F1 m 0,8 l 4,-4 4,0 -8,4 z",
OpposingDirectionDoubleArrow:"F1 m 0,4 l 2,-4 0,2 4,0 0,-2 2,4 -2,4 0,-2 -4,0 0,2 -2,-4 z",PartialDoubleTriangle:"F1 m 0,0 4,3 0,-3 4,4 -4,4 0,-3 -4,3 0,-8 z",LineCircle:"F1 m 0,0 l 0,8 m 7 -4 b 0 360 -3 0 3 z",DoubleLineCircle:"F1 m 0,0 l 0,8 m 2,-8 l 0,8 m 7 -4 b 0 360 -3 0 3 z",TripleLineCircle:"F1 m 0,0 l 0,8 m 2,-8 l 0,8 m 2,-8 l 0,8 m 7 -4 b 0 360 -3 0 3 z",CircleLine:"F1 m 6 4 b 0 360 -3 0 3 z m 1,-4 l 0,8",DiamondCircle:"F1 m 8,4 l -4,4 -4,-4 4,-4 4,4 m 8,0 b 0 360 -4 0 4 z",PlusCircle:"F1 m 8,4 b 0 360 -4 0 4 l -8 0 z m -4 -4 l 0 8",
OpenRightTriangleTop:"m 8,0 l 0,4 -8,0 m 0,4",OpenRightTriangleBottom:"m 8,8 l 0,-4 -8,0",Line:"m 0,0 l 0,8",DoubleLine:"m 0,0 l 0,8 m 2,0 l 0,-8",TripleLine:"m 0,0 l 0,8 m 2,0 l 0,-8 m 2,0 l 0,8",PentagonArrow:"F1 m 8,4 l -4,-4 -4,0 0,8 4,0 4,-4 z"};
function U(a,b){void 0===a||a instanceof Tl||"string"===typeof a?X.call(this,a):(X.call(this),a&&(b=a));this.G=2408959;this.fh=this.Zf="";this.lp=this.hp=this.vp=this.so=null;this.xp="";this.Xf=this.ao=this.wp=this.uh=null;this.jp="";this.ip=Xb;this.bc=this.mp="";this.ri=this.mn=this.bi=null;this.hg=(new K(NaN,NaN)).freeze();this.yo="";this.qf=null;this.zo=Cc;this.np=dd;this.Ho=Ab;this.Ao=Bb;this.Cn=null;this.to=127;this.Cp=Cb;this.Bp="gray";this.sg=4;this.ix=-1;this.Xp=NaN;this.dz=new M;this.xi=
null;this.ig=NaN;b&&Object.assign(this,b)}ma(U,X);
U.prototype.cloneProtected=function(a){X.prototype.cloneProtected.call(this,a);a.G=this.G&-4097|49152;a.Zf=this.Zf;a.fh=this.fh;a.so=this.so;a.vp=this.vp;a.hp=this.hp;a.lp=this.lp;a.xp=this.xp;a.wp=this.wp;a.ao=this.ao;a.Xf=null;a.jp=this.jp;a.ip=this.ip.L();a.mp=this.mp;a.np=this.np.L();a.bc=this.bc;a.mn=this.mn;a.hg.assign(this.hg);a.yo=this.yo;a.zo=this.zo.L();a.Ho=this.Ho.L();a.Ao=this.Ao.L();a.Cn=this.Cn;a.to=this.to;a.Cp=this.Cp.L();a.Bp=this.Bp;a.sg=this.sg;a.Xp=this.Xp};
U.prototype.If=function(a){X.prototype.If.call(this,a);a.Rh();a.uh=null;a.qf=null;a.xi=null};U.prototype.toString=function(){var a=Qa(this.constructor)+"#"+lb(this);null!==this.data&&(a+="("+Ra(this.data)+")");return a};U.prototype.zk=function(a,b,c,d,e,f,g){var h=this.diagram;null!==h&&(a===ue&&"elements"===b?e instanceof X?Ij(e,function(a){Kj(h.partManager,a);Jj(h,a)}):dk(h,e):a===ve&&"elements"===b&&(e instanceof X?Ij(e,function(a){Nj(h.partManager,a,h)}):fk(h,e)),h.bb(a,b,c,d,e,f,g))};
U.prototype.Ka=function(a){X.prototype.Ka.call(this,a);if(null!==this.data){for(var b=this.W.m,c=b.length,d=0;d<c;d++){var e=b[d];e instanceof X&&Ij(e,function(a){null!==a.data&&a.Ka()})}for(b=this.adornments;b.next();)b.value.Ka(a)}};U.prototype.updateRelationshipsFromData=function(){var a;null!==this.data&&(null===(a=this.diagram)||void 0===a?void 0:a.partManager.updateRelationshipsFromData(this))};
U.prototype.hk=function(a){G&&A(a,"string",U,"findAdornment:category");var b=this.Xf;return null===b?null:b.K(a)};U.prototype.Ih=function(a,b){if(null!==b){G&&(A(a,"string",U,"addAdornment:category"),w(b,Ke,U,"addAdornment:ad"));var c=null,d=this.Xf;null!==d&&(c=d.K(a));if(c!==b){if(null!==c){var e=c.diagram;null!==e&&e.remove(c)}null===d&&(this.Xf=d=new yb);b.Zf!==a&&(b.category=a);d.add(a,b);a=this.diagram;null!==a&&(a.add(b),a=b.adornedObject,null!==a&&(a=a.Nh(),null!==a&&(b.data=a.data)))}}};
U.prototype.Sf=function(a){G&&A(a,"string",U,"removeAdornment:category");var b=this.Xf;if(null!==b){var c=b.K(a);if(null!==c){var d=c.diagram;null!==d&&d.remove(c)}b.remove(a);0===b.count&&(this.Xf=null)}};U.prototype.$j=function(){var a=this.Xf;if(null!==a){var b=Na();for(a=a.iterator;a.next();)b.push(a.key);a=b.length;for(var c=0;c<a;c++)this.Sf(b[c]);Pa(b)}};
U.prototype.updateAdornments=function(){var a=this.diagram;if(null!==a){for(var b=this.adornments;b.next();){var c=b.value;c.v();c.placeholder&&c.placeholder.v()}a:{if(this.isSelected&&this.selectionAdorned&&(b=this.selectionObject,null!==b&&this.actualBounds.s()&&this.isVisible()&&b.Rf()&&b.actualBounds.s())){c=this.hk("Selection");if(null===c){c=this.selectionAdornmentTemplate;null===c&&(c=this.Sh()?a.linkSelectionAdornmentTemplate:this instanceof yf?a.groupSelectionAdornmentTemplate:a.nodeSelectionAdornmentTemplate);
if(!(c instanceof Ke))break a;og(c);c=c.copy();null!==c&&(this.Sh()&&this.selectionObject===this.path&&(c.type=X.Link),c.adornedObject=b)}if(null!==c){c.type===X.Link&&c.v();this.Ih("Selection",c);break a}}this.Sf("Selection")}Eo(this,a);for(b=this.adornments;b.next();)b.value.Ka()}};U.prototype.Rb=function(){var a=this.diagram;null!==a&&(Zi(a),0!==(this.G&16384)!==!0&&(this.G|=16384,a.Lb()))};function ni(a){0!==(a.G&16384)!==!1&&(a.updateAdornments(),a.G&=-16385)}
function Eo(a,b){b.toolManager.mouseDownTools.each(function(b){b.isEnabled&&b.updateAdornments(a)});b.toolManager.updateAdornments(a)}function Fo(a){if(!1===xj(a)){Go(a,!0);a.ol();var b=a.diagram;null!==b&&(b.De.add(a),b.Lb())}}function Ho(a){a.G|=2097152;if(!1!==xj(a)){var b=a.position,c=a.location;c.s()&&b.s()||Io(a,b,c);c=a.Cb;var d=M.alloc().assign(c);c.ka();c.x=b.x;c.y=b.y;c.freeze();a.vm(d,c);M.free(d);Go(a,!1)}}
U.prototype.Ie=function(a,b,c,d){var e=this.rc;e.h(a,b,c,d);null===this.Gb&&(this.Gb=new Jb);var f=this.Gb;f.reset();this.Ap(f,a,b,c,d);this.Gb=f;f.Ps()||f.Kq(e)};
U.prototype.Ap=function(a,b,c,d,e){1!==this.ya&&a.scale(this.ya);if(0!==this.Eb){var f=Ic;this.locationSpot.fb()&&(f=this.locationSpot);var g=K.alloc();if(this.locationObject!==this)for(b=this.locationObject,c=b.naturalBounds,g.fj(c.x,c.y,c.width,c.height,f),null!==b.Gb&&b.Gb.Ga(g),g.offset(-b.measuredBounds.x,-b.measuredBounds.y),f=b.panel;null!==f&&f!==this;)null!==f.Gb&&f.Gb.Ga(g),g.offset(-f.measuredBounds.x,-f.measuredBounds.y),f=f.panel;else g.fj(b,c,d,e,f);a.rotate(this.Eb,g.x,g.y);K.free(g)}};
U.prototype.move=function(a,b){!0===b?this.location=a:this.position=a};U.prototype.moveTo=function(a,b,c){a=K.allocAt(a,b);this.move(a,c);K.free(a)};U.prototype.isVisible=function(){if(!this.visible)return!1;var a=this.layer;if(null!==a){if(!a.visible)return!1;a=a.diagram;if(null!==a&&a.animationManager.Ys(this))return!0}a=this.containingGroup;return null===a||a.isSubGraphExpanded&&a.isVisible()?!0:!1};
U.prototype.Tb=function(a){var b=this.diagram;a?(this.C(4),this.Rb(),null!==b&&b.De.add(this)):(this.C(8),this.$j());this.Rh();null!==b&&(b.Wa(),b.R())};U.prototype.eb=function(a){if(this.name===a)return this;var b=this.xi;null===b&&(this.xi=b=new yb);if(null!==b.K(a))return b.K(a);var c=X.prototype.eb.call(this,a);if(null!==c)return b.set(a,c),c;b.set(a,null);return null};
function Jo(a,b,c,d){void 0===d&&(d=new K);c=c.ec()?Ic:c;var e=b.naturalBounds;d.h(e.width*c.x+c.offsetX,e.height*c.y+c.offsetY);if(null===b||b===a)return d;b.transform.Ga(d);for(b=b.panel;null!==b&&b!==a;)b.transform.Ga(d),b=b.panel;null!==a.Gb&&a.Gb.Ga(d);d.offset(-a.rc.x,-a.rc.y);return d}U.prototype.Wi=function(a){void 0===a&&(a=new M);return a.assign(this.actualBounds)};U.prototype.Ya=function(){!0===vj(this)&&this.measure(Infinity,Infinity);this.arrange()};
function Gj(a,b){var c=a.dz;isNaN(a.ig)&&(a.ig=mn(a));var d=a.ig;var e=2*d;if(!a.isShadowed)return c.h(b.x-1-d,b.y-1-d,b.width+2+e,b.height+2+e),c;d=b.x;e=b.y;var f=b.width;b=b.height;var g=a.shadowBlur;a=a.shadowOffset;f+=g;b+=g;d-=g/2;e-=g/2;0<a.x?f+=a.x:(d+=a.x,f-=a.x);0<a.y?b+=a.y:(e+=a.y,b-=a.y);c.h(d-1,e-1,f+2,b+2);return c}
U.prototype.arrange=function(){if(!1===wj(this))Ho(this);else{rl(this,!1);var a=this.Cb,b=M.alloc();b.assign(a);var c=mg(this);this.Kh(0,0,this.rc.width,this.rc.height);var d=this.position;Io(this,d,this.location);a.ka();a.x=d.x;a.y=d.y;a.freeze();this.vm(b,a);b.B(a)?this.Sd(c):!this.Tc()||L.A(b.width,a.width)&&L.A(b.height,a.height)||0<=this.ix&&this.C(16);M.free(b);Go(this,!1)}};t=U.prototype;
t.vm=function(a,b){var c=this.diagram;if(null!==c){var d=!1;if(!1===c.vj&&a.s()){var e=M.alloc();e.assign(c.documentBounds);e.aw(c.padding);a.x>e.x&&a.y>e.y&&a.right<e.right&&a.bottom<e.bottom&&b.x>e.x&&b.y>e.y&&b.right<e.right&&b.bottom<e.bottom&&(d=!0);M.free(e)}0!==(this.G&65536)!==!0&&a.B(b)||Lj(this,d,c);c.R();!a.s()&&!b.s()||dc(a,b)||(this instanceof V&&!c.undoManager.isUndoingRedoing&&this.yd(),this.Rh())}};
t.Xv=function(a,b,c){if(this.Sh()||!a.s())return!1;var d=this.diagram;null!==d&&Ko(this,d,a,b,c);this.pa=a;this.G&=-2097153;var e=this.hg;!e.s()||null!==d&&!d.animationManager.isTicking&&d.undoManager.isUndoingRedoing||(d=e.copy(),e.h(e.x+(a.x-b),e.y+(a.y-c)),this.g("location",d,e.copy()));!1===xj(this)&&!1===wj(this)&&(Fo(this),Ho(this));return!0};function Ko(a,b,c,d,e){null===b||a instanceof Ke||(b=b.animationManager,b.yb&&Qh(b,a,new K(d,e),c))}
t.Km=function(a,b,c){var d=this.hg,e=this.pa;if(c){if(d.x===a&&d.y===b)return;xj(this)||wj(this)?e.h(NaN,NaN):e.h(e.x+a-d.x,e.y+b-d.y);d.h(a,b)}else{if(e.x===a&&e.y===b)return;xj(this)||wj(this)?this.gt():d.h(d.x+a-e.x,d.y+b-e.y);e.h(a,b)}Fo(this)};t.gt=function(){this.G&=-2097153;Fo(this)};
function Io(a,b,c){var d=K.alloc(),e=a.locationObject,f=e.naturalBounds,g=e instanceof Kf?e.strokeWidth:0;d.fj(0,0,f.width+g,f.height+g,a.locationSpot);if(e!==a)for(d.offset(-g/2,-g/2),e.transform.Ga(d),e=e.panel;null!==e&&e!==a;)e.transform.Ga(d),e=e.panel;null!==a.Gb&&a.Gb.Ga(d);d.offset(-a.rc.x,-a.rc.y);e=a.diagram;f=c.s();g=b.s();f&&g?0!==(a.G&2097152)?Lo(a,b,c,e,d):Mo(a,b,c,e,d):f?Lo(a,b,c,e,d):g&&Mo(a,b,c,e,d);a.G|=2097152;K.free(d);a.ol()}
function Lo(a,b,c,d,e){var f=b.x,g=b.y;b.h(c.x-e.x,c.y-e.y);null!==d&&(c=d.animationManager,(d=c.defaultAnimation.isAnimating)||!c.yb||a instanceof Ke||Qh(c,a,new K(f,g),b),d||b.x===f&&b.y===g||a.g("position",new K(f,g),b.copy()))}function Mo(a,b,c,d,e){var f=c.copy();c.h(b.x+e.x,b.y+e.y);c.B(f)||null===d||a.g("location",f,c.copy())}
function Lj(a,b,c){tl(a,!1);a instanceof V&&Dk(c,a);a.layer.isTemporary||b||c.Wa();b=a.Cb;var d=c.viewportBounds;d.s()?mg(a)?(hc(b,d)||a.Sd(!1),a.updateAdornments()):b.Sc(d)?(a.Sd(!0),a.updateAdornments()):a.Rb():c.xj=!0}t.cj=function(){return!0};t.Tc=function(){return!0};t.Sh=function(){return!1};t.bj=function(){return!0};
function No(a,b,c,d){b.constructor===a.constructor||Oo||(Oo=!0,Fa('Should not change the class of the Part when changing category from "'+c+'" to "'+d+'"'),Fa("  Old class: "+Qa(a.constructor)+", new class: "+Qa(b.constructor)+", part: "+a.toString()));a.$j();var e=a.data;c=a.layerName;var f=a.isSelected,g=a.isHighlighted,h=!0,k=!0,l=!1;a instanceof V&&(h=a.isTreeLeaf,k=a.isTreeExpanded,l=a.wasTreeExpanded);b.If(a);b.cloneProtected(a);a.Zf=d;a.v();a.R();b=a.diagram;d=!0;null!==b&&(d=b.skipsUndoManager,
b.skipsUndoManager=!0);a.ob=e;a.G=f?a.G|4096:a.G&-4097;a.G=g?a.G|524288:a.G&-524289;a instanceof V&&(a.U=h?a.U|4:a.U&-5,a.U=k?a.U|1:a.U&-2,a.U=l?a.U|2:a.U&-3);null!==e&&a.Ka();e=a.layerName;e!==c&&(a.fh=c,a.layerName=e);null!==b&&(b.skipsUndoManager=d);a.Tc()&&a.C(64)}U.prototype.canCopy=function(){if(!this.copyable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowCopy)return!1;a=a.diagram;return null===a?!0:a.allowCopy?!0:!1};
U.prototype.canDelete=function(){if(!this.deletable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowDelete)return!1;a=a.diagram;return null===a?!0:a.allowDelete?!0:!1};U.prototype.canEdit=function(){if(!this.textEditable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowTextEdit)return!1;a=a.diagram;return null===a?!0:a.allowTextEdit?!0:!1};
U.prototype.canGroup=function(){if(!this.groupable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowGroup)return!1;a=a.diagram;return null===a?!0:a.allowGroup?!0:!1};U.prototype.canMove=function(){if(!this.movable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowMove)return!1;a=a.diagram;return null===a?!0:a.allowMove?!0:!1};
U.prototype.canReshape=function(){if(!this.reshapable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowReshape)return!1;a=a.diagram;return null===a?!0:a.allowReshape?!0:!1};U.prototype.canResize=function(){if(!this.resizable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowResize)return!1;a=a.diagram;return null===a?!0:a.allowResize?!0:!1};
U.prototype.canRotate=function(){if(!this.rotatable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowRotate)return!1;a=a.diagram;return null===a?!0:a.allowRotate?!0:!1};U.prototype.canSelect=function(){if(!this.selectable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowSelect)return!1;a=a.diagram;return null===a?!0:a.allowSelect?!0:!1};function xj(a){return 0!==(a.G&32768)}function Go(a,b){a.G=b?a.G|32768:a.G&-32769}function tl(a,b){a.G=b?a.G|65536:a.G&-65537}
function mg(a){return 0!==(a.G&131072)}t=U.prototype;t.Sd=function(a){this.G=a?this.G|131072:this.G&-131073};function Po(a,b){a.G=b?a.G|1048576:a.G&-1048577}t.Rh=function(){var a=this.containingGroup;null!==a&&(a.v(),null!==a.placeholder&&a.placeholder.v(),a.yd())};t.R=function(){var a=this.diagram;null!==a&&!wj(this)&&!xj(this)&&this.isVisible()&&this.Cb.s()&&a.R(Gj(this,this.Cb))};
t.v=function(){X.prototype.v.call(this);var a=this.diagram;null!==a&&(a.De.add(this),this instanceof V&&null!==this.labeledLink&&Il(this.labeledLink),a.Lb(!0))};t.pq=function(a){a||(a=this.bi,null!==a&&Qo(a,this))};t.qq=function(a){a||(a=this.bi,null!==a&&Ro(a,this))};t.fk=function(){var a=this.data;if(null!==a){var b=this.diagram;null!==b&&(b=b.model,null!==b&&b.Am(a))}};t.fA=function(){return So(this,this)};
function So(a,b){var c=b.containingGroup;return null!==c?1+So(a,c):b instanceof V&&(b=b.labeledLink,null!==b)?So(a,b):0}t.jA=function(){return To(this,this)};function To(a,b){var c=b.containingGroup;return null!==c||b instanceof V&&(c=b.labeledLink,null!==c)?To(a,c):b}t.Pd=function(a){return a instanceof yf?Uo(this,this,a):!1};function Uo(a,b,c){if(b===c||null===c)return!1;var d=b.containingGroup;return null===d||d!==c&&!Uo(a,d,c)?b instanceof V&&(b=b.labeledLink,null!==b)?Uo(a,b,c):!1:!0}
t.$x=function(a){if(null===a)return null;G&&w(a,U,U,"findCommonContainingGroup:other");if(this===a)return this.containingGroup;for(var b=this;null!==b;){b instanceof yf&&Po(b,!0);if(b instanceof V){var c=b.labeledLink;null!==c&&(b=c)}b=b.containingGroup}c=null;for(b=a;null!==b;){if(0!==(b.G&1048576)){c=b;break}b instanceof V&&(a=b.labeledLink,null!==a&&(b=a));b=b.containingGroup}for(b=this;null!==b;)b instanceof yf&&Po(b,!1),b instanceof V&&(a=b.labeledLink,null!==a&&(b=a)),b=b.containingGroup;return c};
U.prototype.canLayout=function(){if(!this.isLayoutPositioned||!this.isVisible())return!1;var a=this.layer;return null!==a&&a.isTemporary||this instanceof V&&this.isLinkLabel?!1:!0};
U.prototype.C=function(a){void 0===a&&(a=16777215);if(this.isLayoutPositioned&&0!==(a&this.layoutConditions)){var b=this.layer;null!==b&&b.isTemporary||this instanceof V&&this.isLinkLabel?b=!1:(b=this.diagram,b=null!==b&&b.undoManager.isUndoingRedoing?!1:!0)}else b=!1;if(b)if(b=this.bi,null!==b){var c=b.layout;null!==c?c.C():b.C(a)}else a=this.diagram,null!==a&&(a=a.layout,null!==a&&a.C())};function Mj(a){if(!a.isVisible())return!1;a=a.layer;return null!==a&&a.isTemporary?!1:!0}
function $k(a,b,c,d,e,f){void 0===f&&(f=null);if(!(a.contains(b)||null!==f&&!f(b)||b instanceof Ke))if(a.add(b),b instanceof V){if(c&&b instanceof yf)for(var g=b.memberParts;g.next();)$k(a,g.value,c,d,e,f);if(!1!==e)for(g=b.linksConnected;g.next();){var h=g.value;if(!a.contains(h)){var k=h.fromNode,l=h.toNode;k=null===k||a.contains(k);l=null===l||a.contains(l);(e?k&&l:k||l)&&$k(a,h,c,d,e,f)}}if(1<d)for(b=b.fv();b.next();)$k(a,b.value,c,d-1,e,f)}else if(b instanceof R)for(b=b.labelNodes;b.next();)$k(a,
b.value,c,d,e,f)}
na.Object.defineProperties(U.prototype,{key:{configurable:!0,get:function(){var a=this.diagram;if(null!==a)return a.model.va(this.data)}},adornments:{configurable:!0,get:function(){return null===this.Xf?hb:this.Xf.iteratorValues}},layer:{configurable:!0,get:function(){return this.ri}},diagram:{configurable:!0,get:function(){var a=this.ri;return null===a||void 0===a?null:a.diagram}},layerName:{configurable:!0,get:function(){return this.fh},set:function(a){var b=
this.fh;if(b!==a){A(a,"string",U,"layerName");var c=this.diagram;if(null===c||null!==c.ik(a)&&!c.partManager.addsToTemporaryLayer)if(this.fh=a,null!==c&&c.Wa(),this.g("layerName",b,a),b=this.layer,null!==b&&b.name!==a&&(c=b.diagram,null!==c&&(a=c.ik(a),null!==a&&a!==b))){var d=b.kc(-1,this,!0);0<=d&&c.bb(ve,"parts",b,this,null,d,!0);d=a.Yi(99999999,this,!0);b.visible!==a.visible&&this.Tb(a.visible);0<=d&&c.bb(ue,"parts",a,null,this,!0,d);d=this.layerChanged;if(null!==d){var e=c.ba;c.ba=!0;d(this,
b,a);c.ba=e}}}}},layerChanged:{configurable:!0,get:function(){return this.so},set:function(a){var b=this.so;b!==a&&(null!==a&&A(a,"function",U,"layerChanged"),this.so=a,this.g("layerChanged",b,a))}},zOrder:{configurable:!0,get:function(){return this.Xp},set:function(a){var b=this.Xp;if(b!==a){A(a,"number",U,"zOrder");this.Xp=a;var c=this.layer;null!==c&&qi(c,-1,this);this.g("zOrder",b,a);a=this.diagram;null!==a&&a.R()}}},locationObject:{configurable:!0,get:function(){if(null===
this.qf){var a=this.locationObjectName;""!==a?(a=this.eb(a),null!==a?this.qf=a:this.qf=this):this instanceof Ke?this.type!==X.Link&&null!==this.placeholder?this.qf=this.placeholder:this.qf=this:this.qf=this}return this.qf.visible?this.qf:this}},minLocation:{configurable:!0,get:function(){return this.Ho},set:function(a){var b=this.Ho;b.B(a)||(G&&w(a,K,U,"minLocation"),this.Ho=a=a.L(),this.g("minLocation",b,a))}},maxLocation:{configurable:!0,get:function(){return this.Ao},
set:function(a){var b=this.Ao;b.B(a)||(G&&w(a,K,U,"maxLocation"),this.Ao=a=a.L(),this.g("maxLocation",b,a))}},locationObjectName:{configurable:!0,get:function(){return this.yo},set:function(a){var b=this.yo;b!==a&&(G&&A(a,"string",U,"locationObjectName"),this.yo=a,this.qf=null,this.v(),this.g("locationObjectName",b,a))}},locationSpot:{configurable:!0,get:function(){return this.zo},set:function(a){var b=this.zo;b.B(a)||(G&&(w(a,Ib,U,"locationSpot"),a.fb()||v("Part.locationSpot must be a specific Spot value, not: "+
a)),this.zo=a=a.L(),this.v(),this.g("locationSpot",b,a))}},location:{configurable:!0,get:function(){return this.hg},set:function(a){G&&w(a,K,U,"location");var b=a.x,c=a.y,d=this.hg;if(!(d.x===b||isNaN(d.x)&&isNaN(b))||!(d.y===c||isNaN(d.y)&&isNaN(c))){a=a.copy();b=a;if(this.Sh())b=!1;else{this.hg=b;this.G|=2097152;if(!1===wj(this)&&(Fo(this),c=this.pa,c.s())){var e=this.diagram;if(null===e||e.animationManager.isTicking||!e.undoManager.isUndoingRedoing){var f=c.copy();c.h(c.x+(b.x-d.x),
c.y+(b.y-d.y));Ko(this,e,c,f.x,f.y);this.g("position",f,c.copy())}}b=!0}b&&this.g("location",d,a.copy())}}},category:{configurable:!0,get:function(){return this.Zf},set:function(a){var b=this.Zf;if(b!==a){A(a,"string",U,"category");var c=this.diagram,d=this.data,e=null;if(null!==c&&null!==d&&!(this instanceof Ke)){var f=c.model.undoManager;f.isEnabled&&!f.isUndoingRedoing&&(e=this.clone(),e.W.addAll(this.W))}this.Zf=a;this.g("category",b,a);null===c||null===d||this instanceof Ke?this instanceof
Ke&&(e=this.adornedPart,null!==e&&(a=e.Xf,null!==a&&a.remove(b),e.Ih(this.category,this))):(f=c.model,f.undoManager.isUndoingRedoing||(this.Sh()?(c.partManager.setLinkCategoryForData(d,a),c=c.partManager.findLinkTemplateForCategory(a),null!==c&&(og(c),c=c.copy(),null!==c&&No(this,c,b,a))):(null!==f&&f.Hm(d,a),c=Vo(c.partManager,d,a),null!==c&&(og(c),c=c.copy(),null===c||c instanceof R||(d=this.location.copy(),No(this,c,b,a),this.location.s()||(this.location=d)))),null!==e&&(b=this.clone(),b.W.addAll(this.W),
this.g("self",e,b))))}}},self:{configurable:!0,get:function(){return this},set:function(a){No(this,a,this.category,a.category)}},copyable:{configurable:!0,get:function(){return 0!==(this.G&1)},set:function(a){var b=0!==(this.G&1);b!==a&&(G&&A(a,"boolean",U,"copyable"),this.G^=1,this.g("copyable",b,a))}},deletable:{configurable:!0,get:function(){return 0!==(this.G&2)},set:function(a){var b=0!==(this.G&2);b!==a&&(G&&A(a,"boolean",U,"deletable"),this.G^=2,this.g("deletable",
b,a))}},textEditable:{configurable:!0,get:function(){return 0!==(this.G&4)},set:function(a){var b=0!==(this.G&4);b!==a&&(G&&A(a,"boolean",U,"textEditable"),this.G^=4,this.g("textEditable",b,a),this.Rb())}},groupable:{configurable:!0,get:function(){return 0!==(this.G&8)},set:function(a){var b=0!==(this.G&8);b!==a&&(G&&A(a,"boolean",U,"groupable"),this.G^=8,this.g("groupable",b,a))}},movable:{configurable:!0,get:function(){return 0!==(this.G&16)},set:function(a){var b=
0!==(this.G&16);b!==a&&(G&&A(a,"boolean",U,"movable"),this.G^=16,this.g("movable",b,a))}},selectionAdorned:{configurable:!0,get:function(){return 0!==(this.G&32)},set:function(a){var b=0!==(this.G&32);b!==a&&(G&&A(a,"boolean",U,"selectionAdorned"),this.G^=32,this.g("selectionAdorned",b,a),this.Rb())}},isInDocumentBounds:{configurable:!0,get:function(){return 0!==(this.G&64)},set:function(a){var b=0!==(this.G&64);if(b!==a){G&&A(a,"boolean",U,"isInDocumentBounds");this.G^=
64;var c=this.diagram;null!==c&&c.Wa();this.g("isInDocumentBounds",b,a)}}},isLayoutPositioned:{configurable:!0,get:function(){return 0!==(this.G&128)},set:function(a){var b=0!==(this.G&128);b!==a&&(G&&A(a,"boolean",U,"isLayoutPositioned"),this.G^=128,this.g("isLayoutPositioned",b,a),this.C(a?4:8))}},selectable:{configurable:!0,get:function(){return 0!==(this.G&256)},set:function(a){var b=0!==(this.G&256);b!==a&&(G&&A(a,"boolean",U,"selectable"),this.G^=256,this.g("selectable",
b,a),this.Rb())}},reshapable:{configurable:!0,get:function(){return 0!==(this.G&512)},set:function(a){var b=0!==(this.G&512);b!==a&&(G&&A(a,"boolean",U,"reshapable"),this.G^=512,this.g("reshapable",b,a),this.Rb())}},resizable:{configurable:!0,get:function(){return 0!==(this.G&1024)},set:function(a){var b=0!==(this.G&1024);b!==a&&(G&&A(a,"boolean",U,"resizable"),this.G^=1024,this.g("resizable",b,a),this.Rb())}},rotatable:{configurable:!0,get:function(){return 0!==
(this.G&2048)},set:function(a){var b=0!==(this.G&2048);b!==a&&(G&&A(a,"boolean",U,"rotatable"),this.G^=2048,this.g("rotatable",b,a),this.Rb())}},isSelected:{configurable:!0,get:function(){return 0!==(this.G&4096)},set:function(a){var b=0!==(this.G&4096);if(b!==a){G&&A(a,"boolean",U,"isSelected");var c=this.diagram;if(!a||this.canSelect()&&!(null!==c&&c.selection.count>=c.maxSelectionCount)){this.G^=4096;var d=!1;if(null!==c){d=c.skipsUndoManager;c.skipsUndoManager=!0;var e=c.selection;
e.ka();a?e.add(this):e.remove(this);e.freeze()}this.g("isSelected",b,a);this.Rb();a=this.selectionChanged;null!==a&&a(this);null!==c&&(c.Lb(),c.skipsUndoManager=d)}}}},isHighlighted:{configurable:!0,get:function(){return 0!==(this.G&524288)},set:function(a){var b=0!==(this.G&524288);if(b!==a){G&&A(a,"boolean",U,"isHighlighted");this.G^=524288;var c=this.diagram;null!==c&&(c=c.highlighteds,c.ka(),a?c.add(this):c.remove(this),c.freeze());this.g("isHighlighted",b,a);this.R();a=this.highlightedChanged;
null!==a&&a(this)}}},isShadowed:{configurable:!0,get:function(){return 0!==(this.G&8192)},set:function(a){var b=0!==(this.G&8192);b!==a&&(G&&A(a,"boolean",U,"isShadowed"),this.G^=8192,this.g("isShadowed",b,a),this.R())}},isAnimated:{configurable:!0,get:function(){return 0!==(this.G&262144)},set:function(a){var b=0!==(this.G&262144);b!==a&&(G&&A(a,"boolean",U,"isAnimated"),this.G^=262144,this.g("isAnimated",b,a))}},highlightedChanged:{configurable:!0,get:function(){return this.ao},
set:function(a){var b=this.ao;b!==a&&(null!==a&&A(a,"function",U,"highlightedChanged"),this.ao=a,this.g("highlightedChanged",b,a))}},selectionObjectName:{configurable:!0,get:function(){return this.xp},set:function(a){var b=this.xp;b!==a&&(G&&A(a,"string",U,"selectionObjectName"),this.xp=a,this.uh=null,this.g("selectionObjectName",b,a))}},selectionAdornmentTemplate:{configurable:!0,get:function(){return this.vp},set:function(a){var b=this.vp;b!==a&&(G&&w(a,Ke,U,"selectionAdornmentTemplate"),
this.vp=a,this.g("selectionAdornmentTemplate",b,a))}},selectionObject:{configurable:!0,get:function(){if(null===this.uh){var a=this.selectionObjectName;null!==a&&""!==a?(a=this.eb(a),null!==a?this.uh=a:this.uh=this):this instanceof R?(a=this.path,null!==a?this.uh=a:this.uh=this):this.uh=this}return this.uh}},selectionChanged:{configurable:!0,get:function(){return this.wp},set:function(a){var b=this.wp;b!==a&&(null!==a&&A(a,"function",U,"selectionChanged"),this.wp=a,this.g("selectionChanged",
b,a))}},resizeAdornmentTemplate:{configurable:!0,get:function(){return this.hp},set:function(a){var b=this.hp;b!==a&&(G&&w(a,Ke,U,"resizeAdornmentTemplate"),this.hp=a,this.g("resizeAdornmentTemplate",b,a))}},resizeObjectName:{configurable:!0,get:function(){return this.jp},set:function(a){var b=this.jp;b!==a&&(G&&A(a,"string",U,"resizeObjectName"),this.jp=a,this.g("resizeObjectName",b,a))}},resizeObject:{configurable:!0,get:function(){var a=this.resizeObjectName;
return""!==a&&(a=this.eb(a),null!==a)?a:this}},resizeCellSize:{configurable:!0,get:function(){return this.ip},set:function(a){var b=this.ip;b.B(a)||(G&&w(a,Hb,U,"resizeCellSize"),this.ip=a=a.L(),this.g("resizeCellSize",b,a))}},rotateAdornmentTemplate:{configurable:!0,get:function(){return this.lp},set:function(a){var b=this.lp;b!==a&&(G&&w(a,Ke,U,"rotateAdornmentTemplate"),this.lp=a,this.g("rotateAdornmentTemplate",b,a))}},rotateObjectName:{configurable:!0,
get:function(){return this.mp},set:function(a){var b=this.mp;b!==a&&(G&&A(a,"string",U,"rotateObjectName"),this.mp=a,this.g("rotateObjectName",b,a))}},rotateObject:{configurable:!0,get:function(){var a=this.rotateObjectName;return""!==a&&(a=this.eb(a),null!==a)?a:this}},rotationSpot:{configurable:!0,get:function(){return this.np},set:function(a){var b=this.np;b.B(a)||(G&&(w(a,Ib,U,"rotationSpot"),a===dd||a.fb()||v("Part.rotationSpot must be a specific Spot value or Spot.Default, not: "+
a)),this.np=a=a.L(),this.g("rotationSpot",b,a))}},text:{configurable:!0,get:function(){return this.bc},set:function(a){var b=this.bc;b!==a&&(G&&A(a,"string",U,"text"),this.bc=a,this.g("text",b,a))}},containingGroup:{configurable:!0,get:function(){return this.bi},set:function(a){if(this.Tc()){var b=this.bi;if(b!==a){G&&null!==a&&w(a,yf,U,"containingGroup");null===a||this!==a&&!a.Pd(this)||(this===a&&v("Cannot make a Group a member of itself: "+this.toString()),v("Cannot make a Group indirectly contain itself: "+
this.toString()+" already contains "+a.toString()));this.C(2);var c=this.diagram;null!==b?Ro(b,this):this instanceof yf&&null!==c&&c.Hi.remove(this);this.bi=a;null!==a?Qo(a,this):this instanceof yf&&null!==c&&c.Hi.add(this);this.C(1);if(null!==c&&c.ba){var d=this.data,e=c.model;if(null!==d&&e.Zi()){var f=e.va(null!==a?a.data:null);e.Hq(d,f)}}d=this.containingGroupChanged;null!==d&&(e=!0,null!==c&&(e=c.ba,c.ba=!0),d(this,b,a),null!==c&&(c.ba=e));if(this instanceof yf)for(c=new I,$k(c,this,!0,0,!0),
c=c.iterator;c.next();)if(d=c.value,d instanceof V)for(d=d.linksConnected;d.next();)Wo(d.value);if(this instanceof V){for(c=this.linksConnected;c.next();)Wo(c.value);c=this.labeledLink;null!==c&&Wo(c)}this.g("containingGroup",b,a);null!==a&&(b=a.layer,null!==b&&qi(b,-1,a))}}else v("cannot set the Part.containingGroup of a Link or Adornment")}},containingGroupChanged:{configurable:!0,get:function(){return this.mn},set:function(a){var b=this.mn;b!==a&&(null!==a&&A(a,"function",U,"containingGroupChanged"),
this.mn=a,this.g("containingGroupChanged",b,a))}},isTopLevel:{configurable:!0,get:function(){return null!==this.containingGroup||this instanceof V&&null!==this.labeledLink?!1:!0}},layoutConditions:{configurable:!0,get:function(){return this.to},set:function(a){var b=this.to;b!==a&&(G&&A(a,"number",U,"layoutConditions"),this.to=a,this.g("layoutConditions",b,a))}},dragComputation:{configurable:!0,get:function(){return this.Cn},set:function(a){var b=this.Cn;
b!==a&&(null!==a&&A(a,"function",U,"dragComputation"),this.Cn=a,this.g("dragComputation",b,a))}},shadowOffset:{configurable:!0,get:function(){return this.Cp},set:function(a){var b=this.Cp;b.B(a)||(G&&w(a,K,U,"shadowOffset"),this.Cp=a=a.L(),this.R(),this.g("shadowOffset",b,a))}},shadowColor:{configurable:!0,get:function(){return this.Bp},set:function(a){var b=this.Bp;b!==a&&(G&&A(a,"string",U,"shadowColor"),this.Bp=a,this.R(),this.g("shadowColor",b,a))}},shadowBlur:{configurable:!0,
enumerable:!0,get:function(){return this.sg},set:function(a){var b=this.sg;b!==a&&(G&&A(a,"number",U,"shadowBlur"),this.sg=a,this.R(),this.g("shadowBlur",b,a))}}});U.prototype.invalidateLayout=U.prototype.C;U.prototype.findCommonContainingGroup=U.prototype.$x;U.prototype.isMemberOf=U.prototype.Pd;U.prototype.findTopLevelPart=U.prototype.jA;U.prototype.findSubGraphLevel=U.prototype.fA;U.prototype.ensureBounds=U.prototype.Ya;U.prototype.getDocumentBounds=U.prototype.Wi;U.prototype.findObject=U.prototype.eb;
U.prototype.moveTo=U.prototype.moveTo;U.prototype.invalidateAdornments=U.prototype.Rb;U.prototype.clearAdornments=U.prototype.$j;U.prototype.removeAdornment=U.prototype.Sf;U.prototype.addAdornment=U.prototype.Ih;U.prototype.findAdornment=U.prototype.hk;U.prototype.updateTargetBindings=U.prototype.Ka;var Oo=!1;U.className="Part";U.LayoutNone=0;U.LayoutAdded=1;U.LayoutRemoved=2;U.LayoutShown=4;U.LayoutHidden=8;U.LayoutNodeSized=16;U.LayoutGroupLayout=32;U.LayoutNodeReplaced=64;U.LayoutStandard=127;
U.LayoutAll=16777215;function Ke(a,b){void 0===a||a instanceof Tl||"string"===typeof a?U.call(this,a):(U.call(this),a&&(b=a));this.G&=-257;this.fh="Adornment";this.ue=null;this.mx=0;this.Gx=!1;this.j=this.Sa=null;b&&Object.assign(this,b)}ma(Ke,U);Ke.prototype.toString=function(){var a=this.adornedPart;return"Adornment("+this.category+")"+(null!==a?a.toString():"")};Ke.prototype.updateRelationshipsFromData=function(){};
Ke.prototype.rk=function(a){var b=this.adornedObject,c=null===b||void 0===b?void 0:b.part;if(c instanceof R&&b instanceof Kf){b=c.path;c.rk(a);a=b.geometry;c=this.W.m;b=c.length;for(var d=0;d<b;d++){var e=c[d];e.isPanelMain&&e instanceof Kf&&(e.sa=a)}}};Ke.prototype.cj=function(){var a=this.ue;if(null===a)return!0;a=a.part;return null===a||!wj(a)};Ke.prototype.Tc=function(){return!1};
Ke.prototype.zk=function(a,b,c,d,e,f,g){if(a===ue&&"elements"===b)if(e instanceof ng)null===this.Sa?this.Sa=e:G&&this.Sa!==e&&v("Cannot insert a second Placeholder into the visual tree of an Adornment.");else{if(e instanceof X){var h=e.lm(function(a){return a instanceof ng});h instanceof ng&&(null===this.Sa?this.Sa=h:G&&this.Sa!==h&&v("Cannot insert a second Placeholder into the visual tree of an Adornment."))}}else a===ve&&"elements"===b&&null!==this.Sa&&(d===this.Sa?this.Sa=null:d instanceof X&&
this.Sa.Dg(d)&&(this.Sa=null));U.prototype.zk.call(this,a,b,c,d,e,f,g)};Ke.prototype.updateAdornments=function(){};Ke.prototype.fk=function(){};
na.Object.defineProperties(Ke.prototype,{placeholder:{configurable:!0,get:function(){return this.Sa}},adornedObject:{configurable:!0,get:function(){return this.ue},set:function(a){G&&null!==a&&w(a,O,U,"adornedObject:value");var b=this.adornedPart,c=null;null!==a&&(c=a.part);null===b||null!==a&&b===c||b.Sf(this.category);this.ue=a;null!==c&&c.Ih(this.category,this)}},adornedPart:{configurable:!0,get:function(){var a=this.ue;return null!==a?a.part:null}},containingGroup:{configurable:!0,
enumerable:!0,get:function(){return null}}});Ke.className="Adornment";function V(a,b){void 0===a||a instanceof Tl||"string"===typeof a?U.call(this,a):(U.call(this),a&&(b=a));this.U=13;this.ib=new H;this.Qp=this.tl=this.ui=this.vo=this.uo=null;this.Mk=Ac;this.tc=this.ef=null;this.ep=Xo;this.Gh=!1;b&&Object.assign(this,b)}ma(V,U);
V.prototype.cloneProtected=function(a){U.prototype.cloneProtected.call(this,a);a.U=this.U;a.U=this.U&-17;a.uo=this.uo;a.vo=this.vo;a.ui=this.ui;a.Qp=this.Qp;a.Mk=this.Mk.L();a.ep=this.ep};t=V.prototype;t.If=function(a){U.prototype.If.call(this,a);a.yd();a.ef=this.ef;a.tc=null};function Yo(a,b){null!==b&&(null===a.ef&&(a.ef=new I),a.ef.add(b))}
function Zo(a,b,c,d){if(null===b||null===a.ef)return null;for(var e=a.ef.iterator;e.next();){var f=e.value;if(f.Ws===a&&f.Bv===b&&f.Dy===c&&f.Ey===d||f.Ws===b&&f.Bv===a&&f.Dy===d&&f.Ey===c)return f}return null}t.CA=function(a,b,c){if(void 0===b||null===b)b="";if(void 0===c||null===c)c="";a=Zo(this,a,b,c);null!==a&&a.qm()};t.zk=function(a,b,c,d,e,f,g){a===ue&&"elements"===b?this.tc=null:a===ve&&"elements"===b&&(this.tc=null);U.prototype.zk.call(this,a,b,c,d,e,f,g)};
t.yd=function(a){for(var b=this.linksConnected;b.next();){var c=b.value;void 0!==a&&a.contains(c)||($o(c.fromPort),$o(c.toPort),c.$a())}};function ul(a,b){for(a=a.linksConnected;a.next();){var c=a.value;if(c.fromPort===b||c.toPort===b)$o(c.fromPort),$o(c.toPort),c.$a()}}function $o(a){if(null!==a){var b=a.cp;null!==b&&b.qm();a=a.part;b=a.containingGroup;null===b||a.isVisible()||$o(b.port)}}t.cj=function(){return!0};V.prototype.getAvoidableRect=function(a){a.set(this.actualBounds);a.Yp(this.Mk);return a};
V.prototype.findVisibleNode=function(){for(var a=this;null!==a&&!a.isVisible();)a=a.containingGroup;return a};
V.prototype.isVisible=function(){if(!U.prototype.isVisible.call(this))return!1;var a=!0,b=Ei,c=this.diagram;if(null!==c){if(c.animationManager.Ys(this))return!0;a=c.isTreePathToChildren;b=c.treeCollapsePolicy}if(b===Ei){if(a=this.Cg(),null!==a&&!a.isTreeExpanded)return!1}else if(b===Lk){if(a=a?this.cv():this.dv(),0<a.count&&a.all(function(a){return!a.isTreeExpanded}))return!1}else if(b===Mk&&(a=a?this.cv():this.dv(),0<a.count&&a.any(function(a){return!a.isTreeExpanded})))return!1;a=this.labeledLink;
return null!==a?a.isVisible():!0};V.prototype.Tb=function(a){U.prototype.Tb.call(this,a);for(var b=this.linksConnected;b.next();){var c=b.value;if(a&&null!==this.containingGroup){var d=c.nq(this);null===d||d.Pd(this.containingGroup)||c.$a()}c.Tb(a)}};V.prototype.ay=function(){var a=new I,b=new I;ap(this,this,a,b);return b.iterator};
function ap(a,b,c,d){if(null!==b&&!c.has(b)){c.add(b);var e=!0,f=a.diagram;null!==f&&(e=f.isTreePathToChildren);b.linksConnected.each(function(f){f.isTreeLink?(e?f.fromNode===b:f.toNode===b)&&ap(a,e?f.toNode:f.fromNode,c,d):d.add(f)})}}
V.prototype.findLinksConnected=function(a){void 0===a&&(a=null);if(null===a)return this.ib.iterator;G&&A(a,"string",V,"findLinksConnected:pid");var b=new jb(this.ib),c=this;b.predicate=function(b){return b.fromNode===c&&b.fromPortId===a||b.toNode===c&&b.toPortId===a};return b};t=V.prototype;t.iq=function(a){void 0===a&&(a=null);G&&null!==a&&A(a,"string",V,"findLinksOutOf:pid");var b=new jb(this.ib),c=this;b.predicate=function(b){return b.fromNode!==c?!1:null===a?!0:b.fromPortId===a};return b};
t.Nd=function(a){void 0===a&&(a=null);G&&null!==a&&A(a,"string",V,"findLinksInto:pid");var b=new jb(this.ib),c=this;b.predicate=function(b){return b.toNode!==c?!1:null===a?!0:b.toPortId===a};return b};
t.bv=function(a){void 0===a&&(a=null);G&&null!==a&&A(a,"string",V,"findNodesConnected:pid");for(var b=null,c=null,d=this.ib.iterator;d.next();){var e=d.value;if(e.fromNode===this){if(null===a||e.fromPortId===a)e=e.toNode,null!==b?b.add(e):null!==c&&c!==e?(b=new I,b.add(c),b.add(e)):c=e}else e.toNode!==this||null!==a&&e.toPortId!==a||(e=e.fromNode,null!==b?b.add(e):null!==c&&c!==e?(b=new I,b.add(c),b.add(e)):c=e)}return null!==b?b.iterator:null!==c?new ib(c):hb};
t.dv=function(a){void 0===a&&(a=null);G&&null!==a&&A(a,"string",V,"findNodesOutOf:pid");for(var b=null,c=null,d=this.ib.iterator;d.next();){var e=d.value;e.fromNode!==this||null!==a&&e.fromPortId!==a||(e=e.toNode,null!==b?b.add(e):null!==c&&c!==e?(b=new I,b.add(c),b.add(e)):c=e)}return null!==b?b.iterator:null!==c?new ib(c):hb};
t.cv=function(a){void 0===a&&(a=null);G&&null!==a&&A(a,"string",V,"findNodesInto:pid");for(var b=null,c=null,d=this.ib.iterator;d.next();){var e=d.value;e.toNode!==this||null!==a&&e.toPortId!==a||(e=e.fromNode,null!==b?b.add(e):null!==c&&c!==e?(b=new I,b.add(c),b.add(e)):c=e)}return null!==b?b.iterator:null!==c?new ib(c):hb};
t.aA=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);G&&(w(a,V,V,"findLinksBetween:othernode"),null!==b&&A(b,"string",V,"findLinksBetween:pid"),null!==c&&A(c,"string",V,"findLinksBetween:otherpid"));var d=new jb(this.ib),e=this;d.predicate=function(d){return(d.fromNode!==e||d.toNode!==a||null!==b&&d.fromPortId!==b||null!==c&&d.toPortId!==c)&&(d.fromNode!==a||d.toNode!==e||null!==c&&d.fromPortId!==c||null!==b&&d.toPortId!==b)?!1:!0};return d};
t.bA=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);G&&(w(a,V,V,"findLinksTo:othernode"),null!==b&&A(b,"string",V,"findLinksTo:pid"),null!==c&&A(c,"string",V,"findLinksTo:otherpid"));var d=new jb(this.ib),e=this;d.predicate=function(d){return d.fromNode!==e||d.toNode!==a||null!==b&&d.fromPortId!==b||null!==c&&d.toPortId!==c?!1:!0};return d};
function bp(a,b,c){$o(c);var d=a.ib.contains(b);d||a.ib.add(b);if(!d||b.fromNode===b.toNode){var e=a.linkConnected;if(null!==e){var f=!0,g=a.diagram;null!==g&&(f=g.ba,g.ba=!0);e(a,b,c);null!==g&&(g.ba=f)}}!d&&b.isTreeLink&&(c=b.fromNode,b=b.toNode,null!==c&&null!==b&&c!==b&&(d=!0,a=a.diagram,null!==a&&(d=a.isTreePathToChildren),e=d?b:c,f=d?c:b,e.Gh||(e.Gh=f),!f.isTreeLeaf||null!==a&&a.undoManager.isUndoingRedoing||(d?c===f&&(f.isTreeLeaf=!1):b===f&&(f.isTreeLeaf=!1))))}
function cp(a,b,c){$o(c);var d=a.ib.remove(b),e=null;if(d||b.toNode===b.fromNode){var f=a.linkDisconnected;e=a.diagram;if(null!==f){var g=!0;null!==e&&(g=e.ba,e.ba=!0);f(a,b,c);null!==e&&(e.ba=g)}}d&&b.isTreeLink&&(c=!0,null!==e&&(c=e.isTreePathToChildren),a=c?b.toNode:b.fromNode,b=c?b.fromNode:b.toNode,null!==a&&(a.Gh=!1),null===b||b.isTreeLeaf||(0===b.ib.count?(b.Gh=null,null!==e&&e.undoManager.isUndoingRedoing||(b.isTreeLeaf=!0)):Kk(b)))}
function Kk(a){a.Gh=!1;if(0!==a.ib.count){var b=!0,c=a.diagram;if(null===c||!c.undoManager.isUndoingRedoing){null!==c&&(b=c.isTreePathToChildren);for(c=a.ib.iterator;c.next();){var d=c.value;if(d.isTreeLink)if(b){if(d.fromNode===a){a.isTreeLeaf=!1;return}}else if(d.toNode===a){a.isTreeLeaf=!1;return}}a.isTreeLeaf=!0}}}V.prototype.updateRelationshipsFromData=function(){var a=this.diagram;null!==a&&a.partManager.updateRelationshipsFromData(this)};t=V.prototype;
t.pq=function(a){U.prototype.pq.call(this,a);a||(Kk(this),a=this.tl,null!==a&&dp(a,this))};t.qq=function(a){U.prototype.qq.call(this,a);a||(a=this.tl,null!==a&&null!==a.ud&&(a.ud.remove(this),a.v()))};
t.fk=function(){if(0<this.ib.count){var a=this.diagram;if(null!==a)for(var b=null!==a.commandHandler?a.commandHandler.deletesConnectedLinks:!0,c=this.ib.copy().iterator;c.next();){var d=c.value;b?a.remove(d):(d.fromNode===this&&(d.fromNode=null),d.toNode===this&&(d.toNode=null))}}this.labeledLink=null;U.prototype.fk.call(this)};
t.Es=function(a){G&&A(a,"string",V,"findPort:pid");if(null===this.tc){if(""===a&&!1===this.We)return this;ep(this)}var b=this.tc.K(a);return null!==b||""!==a&&(b=this.tc.K(""),null!==b)?b:this};function ep(a){null===a.tc?a.tc=new yb:a.tc.clear();a.Bk(a,function(a,c){Yl(a,c)});0===a.tc.count&&a.tc.add("",a)}function Yl(a,b){var c=b.portId;null!==c&&null!==a.tc&&a.tc.add(c,b)}
function Xl(a,b,c){var d=b.portId;if(null!==d&&(null!==a.tc&&a.tc.remove(d),b=a.diagram,null!==b&&c)){c=null;for(a=a.findLinksConnected(d);a.next();)d=a.value,null===c&&(c=Na()),c.push(d);if(null!==c){for(a=0;a<c.length;a++)b.remove(c[a]);Pa(c)}}}
t.EA=function(a){if(null===a||a===this)return!1;var b=!0,c=this.diagram;null!==c&&(b=c.isTreePathToChildren);c=this;if(b)for(;c!==a;){b=null;for(var d=c.ib.iterator;d.next();){var e=d.value;if(e.isTreeLink&&(b=e.fromNode,b!==c&&b!==this))break}if(b===this||null===b||b===c)return!1;c=b}else for(;c!==a;){b=null;for(d=c.ib.iterator;d.next()&&(e=d.value,!e.isTreeLink||(b=e.toNode,b===c||b===this)););if(b===this||null===b||b===c)return!1;c=b}return!0};
t.nA=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);b=this;if(a)for(;;){a=null;for(var c=b.ib.iterator;c.next();){var d=c.value;if(d.isTreeLink&&(a=d.fromNode,a!==b&&a!==this))break}if(a===this)return this;if(null===a||a===b)return b;b=a}else for(;;){a=null;for(c=b.ib.iterator;c.next()&&(d=c.value,!d.isTreeLink||(a=d.toNode,a===b||a===this)););if(a===this)return this;if(null===a||a===b)return b;b=a}};
t.Yz=function(a){if(null===a)return null;G&&w(a,V,V,"findCommonTreeParent:other");if(this===a)return this;for(var b=this;null!==b;)Po(b,!0),b=b.Cg();var c=null;for(b=a;null!==b;){if(0!==(b.G&1048576)){c=b;break}b=b.Cg()}for(b=this;null!==b;)Po(b,!1),b=b.Cg();return c};
t.Ti=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);b=this.ib.iterator;if(a)for(;b.next();){if(a=b.value,a.isTreeLink&&a.fromNode!==this)return a}else for(;b.next();)if(a=b.value,a.isTreeLink&&a.toNode!==this)return a;return null};
t.Cg=function(){var a=this.Gh;if(null===a)return null;if(a instanceof V)return a;var b=!0;a=this.diagram;null!==a&&(b=a.isTreePathToChildren);a=this.ib.iterator;if(b)for(;a.next();){if(b=a.value,b.isTreeLink&&(b=b.fromNode,b!==this))return this.Gh=b}else for(;a.next();)if(b=a.value,b.isTreeLink&&(b=b.toNode,b!==this))return this.Gh=b;return this.Gh=null};t.lA=function(){function a(b,d){d.add(b);var c=b.Ti();null!==c&&(d.add(c),b=b.Cg(),null!==b&&a(b,d))}var b=new I;a(this,b);return b};
t.kA=function(){return fp(this,this)};function fp(a,b){b=b.Cg();return null===b?0:1+fp(a,b)}t.kq=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);b=new jb(this.ib);var c=this;b.predicate=a?function(a){return a.isTreeLink&&a.fromNode===c?!0:!1}:function(a){return a.isTreeLink&&a.toNode===c?!0:!1};return b};
t.fv=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);var c=b=null,d=this.ib.iterator;if(a)for(;d.next();)a=d.value,a.isTreeLink&&a.fromNode===this&&(a=a.toNode,null!==b?b.add(a):null!==c&&c!==a?(b=new H,b.add(c),b.add(a)):c=a);else for(;d.next();)a=d.value,a.isTreeLink&&a.toNode===this&&(a=a.fromNode,null!==b?b.add(a):null!==c&&c!==a?(b=new H,b.add(c),b.add(a)):c=a);return null!==b?b.iterator:null!==c?new ib(c):hb};
t.mA=function(a){void 0===a&&(a=Infinity);A(a,"number",V,"findTreeParts:level");var b=new I;$k(b,this,!1,a,!0);return b};V.prototype.collapseTree=function(a){void 0===a&&(a=1);E(a,V,"collapseTree:level");1>a&&(a=1);var b=this.diagram;if(null!==b&&!b.Xe){b.Xe=!0;var c=new I;c.add(this);gp(this,c,b.isTreePathToChildren,a,b,this,b.treeCollapsePolicy===Ei);b.Xe=!1}};
function gp(a,b,c,d,e,f,g){if(1<d)for(var h=c?a.iq():a.Nd();h.next();){var k=h.value;k.isTreeLink&&(k=k.nq(a),null===k||k===a||b.contains(k)||(b.add(k),gp(k,b,c,d-1,e,f,g)))}else hp(a,b,c,e,f,g)}
function hp(a,b,c,d,e,f){for(var g=e===a?!0:a.isTreeExpanded,h=c?a.iq():a.Nd();h.next();){var k=h.value;if(k.isTreeLink&&(k=k.nq(a),null!==k&&k!==a)){var l=b.contains(k);l||b.add(k);g&&(f&&d.Wj(k,e),k.Rh(),k.Tb(!1));k.isTreeExpanded&&(k.wasTreeExpanded=k.isTreeExpanded,l||hp(k,b,c,d,e,f))}}a.isTreeExpanded=!1}
V.prototype.expandTree=function(a){void 0===a&&(a=2);E(a,V,"expandTree:level");2>a&&(a=2);var b=this.diagram;if(null!==b&&!b.Xe){b.Xe=!0;var c=new I;c.add(this);ip(this,c,b.isTreePathToChildren,a,b,this,b.treeCollapsePolicy===Ei);b.Xe=!1}};
function ip(a,b,c,d,e,f,g){for(var h=f===a?!1:a.isTreeExpanded,k=c?a.iq():a.Nd();k.next();){var l=k.value;l.isTreeLink&&(h||l.Ad||l.$a(),l=l.nq(a),null!==l&&l!==a&&!b.contains(l)&&(b.add(l),h||(l.Tb(!0),l.Rh(),g&&e.Yj(l,f)),2<d||l.wasTreeExpanded))&&(l.wasTreeExpanded=!1,ip(l,b,c,d-1,e,f,g))}a.isTreeExpanded=!0}
na.Object.defineProperties(V.prototype,{portSpreading:{configurable:!0,get:function(){return this.ep},set:function(a){var b=this.ep;b!==a&&(G&&a!==jp&&a!==Xo&&a!==kp&&v("Node.portSpreading can only be set to Node.SpreadingNone, Node.SpreadingEvenly, or Node.SpreadingPacked, not: "+a),this.ep=a,this.g("portSpreading",b,a),a=this.diagram,null!==a&&a.undoManager.isUndoingRedoing||this.yd())}},avoidable:{configurable:!0,get:function(){return 0!==(this.U&8)},set:function(a){var b=
0!==(this.U&8);if(b!==a){G&&A(a,"boolean",V,"avoidable");this.U^=8;var c=this.diagram;null!==c&&Dk(c,this);this.g("avoidable",b,a)}}},avoidableMargin:{configurable:!0,get:function(){return this.Mk},set:function(a){"number"===typeof a?a=new fc(a):w(a,fc,V,"avoidableMargin");var b=this.Mk;if(!b.B(a)){this.Mk=a=a.L();var c=this.diagram;null!==c&&Dk(c,this);this.g("avoidableMargin",b,a)}}},linksConnected:{configurable:!0,get:function(){return this.ib.iterator}},linkConnected:{configurable:!0,
enumerable:!0,get:function(){return this.uo},set:function(a){var b=this.uo;b!==a&&(null!==a&&A(a,"function",V,"linkConnected"),this.uo=a,this.g("linkConnected",b,a))}},linkDisconnected:{configurable:!0,get:function(){return this.vo},set:function(a){var b=this.vo;b!==a&&(null!==a&&A(a,"function",V,"linkDisconnected"),this.vo=a,this.g("linkDisconnected",b,a))}},linkValidation:{configurable:!0,get:function(){return this.ui},set:function(a){var b=this.ui;b!==a&&(null!==a&&
A(a,"function",V,"linkValidation"),this.ui=a,this.g("linkValidation",b,a))}},isLinkLabel:{configurable:!0,get:function(){return null!==this.tl}},labeledLink:{configurable:!0,get:function(){return this.tl},set:function(a){var b=this.tl;if(b!==a){G&&null!==a&&w(a,R,V,"labeledLink");var c=this.diagram,d=this.data;if(null!==b){null!==b.ud&&(b.ud.remove(this),b.v());if(null!==c&&null!==d&&!c.undoManager.isUndoingRedoing){var e=b.data,f=c.model;if(null!==e&&f.aj()){var g=f.va(d);
void 0!==g&&f.Fy(e,g)}}this.containingGroup=null}this.tl=a;null!==a&&(dp(a,this),null===c||null===d||c.undoManager.isUndoingRedoing||(e=a.data,c=c.model,null!==e&&c.aj()&&(d=c.va(d),void 0!==d&&c.Gu(e,d))),this.containingGroup=a.containingGroup);Il(this);this.g("labeledLink",b,a)}}},port:{configurable:!0,get:function(){return this.Es("")}},ports:{configurable:!0,get:function(){null===this.tc&&ep(this);return this.tc.iteratorValues}},isTreeExpanded:{configurable:!0,
get:function(){return 0!==(this.U&1)},set:function(a){var b=0!==(this.U&1);if(b!==a){G&&A(a,"boolean",V,"isTreeExpanded");this.U^=1;var c=this.diagram;this.g("isTreeExpanded",b,a);b=this.treeExpandedChanged;if(null!==b){var d=!0;null!==c&&(d=c.ba,c.ba=!0);b(this);null!==c&&(c.ba=d)}null!==c&&c.undoManager.isUndoingRedoing?this.Tb(a):a?this.expandTree():this.collapseTree()}}},wasTreeExpanded:{configurable:!0,get:function(){return 0!==(this.U&2)},set:function(a){var b=0!==(this.U&2);b!==
a&&(G&&A(a,"boolean",V,"wasTreeExpanded"),this.U^=2,this.g("wasTreeExpanded",b,a))}},treeExpandedChanged:{configurable:!0,get:function(){return this.Qp},set:function(a){var b=this.Qp;b!==a&&(null!==a&&A(a,"function",V,"treeExpandedChanged"),this.Qp=a,this.g("treeExpandedChanged",b,a))}},isTreeLeaf:{configurable:!0,get:function(){return 0!==(this.U&4)},set:function(a){var b=0!==(this.U&4);b!==a&&(G&&A(a,"boolean",V,"isTreeLeaf"),this.U^=4,this.g("isTreeLeaf",b,a))}}});
V.prototype.expandTree=V.prototype.expandTree;V.prototype.collapseTree=V.prototype.collapseTree;V.prototype.findTreeParts=V.prototype.mA;V.prototype.findTreeChildrenNodes=V.prototype.fv;V.prototype.findTreeChildrenLinks=V.prototype.kq;V.prototype.findTreeLevel=V.prototype.kA;V.prototype.findTreeParentChain=V.prototype.lA;V.prototype.findTreeParentNode=V.prototype.Cg;V.prototype.findTreeParentLink=V.prototype.Ti;V.prototype.findCommonTreeParent=V.prototype.Yz;V.prototype.findTreeRoot=V.prototype.nA;
V.prototype.isInTreeOf=V.prototype.EA;V.prototype.findPort=V.prototype.Es;V.prototype.findLinksTo=V.prototype.bA;V.prototype.findLinksBetween=V.prototype.aA;V.prototype.findNodesInto=V.prototype.cv;V.prototype.findNodesOutOf=V.prototype.dv;V.prototype.findNodesConnected=V.prototype.bv;V.prototype.findLinksInto=V.prototype.Nd;V.prototype.findLinksOutOf=V.prototype.iq;V.prototype.findExternalTreeLinksConnected=V.prototype.ay;V.prototype.invalidateConnectedLinks=V.prototype.yd;
V.prototype.invalidateLinkBundle=V.prototype.CA;var jp=new F(V,"SpreadingNone",10),Xo=new F(V,"SpreadingEvenly",11),kp=new F(V,"SpreadingPacked",12);V.className="Node";V.SpreadingNone=jp;V.SpreadingEvenly=Xo;V.SpreadingPacked=kp;function yf(a,b){void 0===a||a instanceof Tl||"string"===typeof a?V.call(this,a):(V.call(this),a&&(b=a));this.U|=4608;this.Fo=new I;this.Cl=new I;this.Sa=this.Jp=this.wi=this.Go=this.Eo=this.hb=null;this.Kc=new zi;this.Kc.group=this;this.mr=null;b&&Object.assign(this,b)}
ma(yf,V);yf.prototype.cloneProtected=function(a){V.prototype.cloneProtected.call(this,a);this.U=this.U&-32769;null!==this.hb&&(a.hb=this.hb.copy());a.Eo=this.Eo;a.Go=this.Go;a.wi=this.wi;a.Jp=this.Jp;var b=a.lm(function(a){return a instanceof ng});b instanceof ng?a.Sa=b:a.Sa=null;null!==this.Kc?(a.Kc=this.Kc.copy(),a.Kc.group=a):(null!==a.Kc&&(a.Kc.group=null),a.Kc=null)};t=yf.prototype;
t.If=function(a){V.prototype.If.call(this,a);var b=a.jk();for(a=a.memberParts;a.next();){var c=a.value;c.v();c.C(8);c.$j();if(c instanceof V)c.yd(b);else if(c instanceof R)for(c=c.labelNodes;c.next();)c.value.yd(b)}};
t.zk=function(a,b,c,d,e,f,g){if(a===ue&&"elements"===b)if(e instanceof ng)null===this.Sa?this.Sa=e:this.Sa!==e&&v("Cannot insert a second Placeholder into the visual tree of a Group.");else{if(e instanceof X){var h=e.lm(function(a){return a instanceof ng});h instanceof ng&&(null===this.Sa?this.Sa=h:this.Sa!==h&&v("Cannot insert a second Placeholder into the visual tree of a Group."))}}else a===ve&&"elements"===b&&null!==this.Sa&&(d===this.Sa?this.Sa=null:d instanceof X&&this.Sa.Dg(d)&&(this.Sa=null));
V.prototype.zk.call(this,a,b,c,d,e,f,g)};t.vm=function(a,b){V.prototype.vm.call(this,a,b);this.isClipping&&this.type!==X.Spot&&this.isSubGraphExpanded&&(a=this.resizeObject,a instanceof X&&(a=a.ub()),null===this.hb&&(this.hb=new M),a.Wi(this.hb),a instanceof Kf&&this.hb.Qc(-a.strokeWidth,-a.strokeWidth))};t.Kh=function(a,b,c,d){this.qf=this.Sa;V.prototype.Kh.call(this,a,b,c,d)};
t.Ya=function(){var a=this;a.isSubGraphExpanded&&this.memberParts.each(function(b){!a.computesBoundsIncludingLinks&&b instanceof R||b.Ya()});V.prototype.Ya.call(this)};t.cj=function(){if(!V.prototype.cj.call(this))return!1;for(var a=this.memberParts;a.next();){var b=a.value;if(b instanceof V){if(b.isVisible()&&wj(b))return!1}else if(b instanceof R&&b.isVisible()&&wj(b)&&b.fromNode!==this&&b.toNode!==this)return!1}return!0};
function Qo(a,b){if(a.Fo.add(b)){b instanceof yf&&a.Cl.add(b);var c=a.memberAdded;if(null!==c){var d=!0,e=a.diagram;null!==e&&(d=e.ba,e.ba=!0);c(a,b);null!==e&&(e.ba=d)}a.isVisible()&&a.isSubGraphExpanded||b.Tb(!1)}b instanceof R&&!a.computesBoundsIncludingLinks||(b=a.Sa,null===b&&(b=a),b.v())}
function Ro(a,b){if(a.Fo.remove(b)){b instanceof yf&&a.Cl.remove(b);var c=a.memberRemoved;if(null!==c){var d=!0,e=a.diagram;null!==e&&(d=e.ba,e.ba=!0);c(a,b);null!==e&&(e.ba=d)}a.isVisible()&&a.isSubGraphExpanded||b.Tb(!0)}b instanceof R&&!a.computesBoundsIncludingLinks||(b=a.Sa,null===b&&(b=a),b.v())}t.fk=function(){if(0<this.Fo.count){var a=this.diagram;if(null!==a)for(var b=this.Fo.copy().iterator;b.next();)a.remove(b.value)}V.prototype.fk.call(this)};
yf.prototype.canAddMembers=function(a){var b=this.diagram;if(null===b)return!1;b=b.commandHandler;for(a=bl(a).iterator;a.next();)if(!b.isValidMember(this,a.value))return!1;return!0};yf.prototype.addMembers=function(a,b){var c=this.diagram;if(null===c)return!1;c=c.commandHandler;var d=!0;for(a=bl(a).iterator;a.next();){var e=a.value;!b||c.isValidMember(this,e)?e.containingGroup=this:d=!1}return d};
yf.prototype.canUngroup=function(){if(!this.ungroupable)return!1;var a=this.layer;if(null!==a&&!a.allowUngroup)return!1;a=a.diagram;return null===a||a.allowUngroup?!0:!1};t=yf.prototype;
t.yd=function(a){var b=0!==(this.U&65536);V.prototype.yd.call(this,a);if(!b)for(0!==(this.U&65536)!==!0&&(this.U=this.U^65536),b=this.av();b.next();){var c=b.value;if(void 0===a||!a.contains(c)){var d=c.fromNode;null!==d&&d!==this&&d.Pd(this)&&!d.isVisible()?($o(c.fromPort),$o(c.toPort),c.$a()):(d=c.toNode,null!==d&&d!==this&&d.Pd(this)&&!d.isVisible()&&($o(c.fromPort),$o(c.toPort),c.$a()))}}};
t.av=function(){var a=null!==this.diagram&&this.diagram.Bx;if(a&&null!==this.mr)return this.mr.iterator;var b=this.jk();b.add(this);for(var c=new I,d=b.iterator;d.next();){var e=d.value;if(e instanceof V)for(e=e.linksConnected;e.next();){var f=e.value;b.contains(f)||c.add(f)}}a&&(this.mr=c);return c.iterator};
t.$z=function(){var a=this.jk();a.add(this);for(var b=new I,c=a.iterator;c.next();){var d=c.value;if(d instanceof V)for(d=d.linksConnected;d.next();){var e=d.value,f=e.fromNode;null===f||a.contains(f)&&f!==this||b.add(f);e=e.toNode;null===e||a.contains(e)&&e!==this||b.add(e)}}return b.iterator};t.Zz=function(){function a(b,d){null!==b&&(d.add(b),a(b.containingGroup,d))}var b=new I;a(this,b);return b};t.jk=function(){var a=new I;$k(a,this,!0,0,!0);a.remove(this);return a};
t.Tb=function(a){V.prototype.Tb.call(this,a);for(var b=this.memberParts;b.next();)b.value.Tb(a)};yf.prototype.collapseSubGraph=function(){var a=this.diagram;if(null!==a&&!a.Xe){a.Xe=!0;var b=this.jk();lp(this,b,a,this);a.Xe=!1}};
function lp(a,b,c,d){for(var e=a.memberParts;e.next();){var f=e.value;f.Tb(!1);f instanceof yf&&f.isSubGraphExpanded&&(f.wasSubGraphExpanded=f.isSubGraphExpanded,lp(f,b,c,d));if(f instanceof V)f.yd(b),c.Wj(f,d);else if(f instanceof R)for(f=f.labelNodes;f.next();)f.value.yd(b)}a.isSubGraphExpanded=!1}yf.prototype.expandSubGraph=function(){var a=this.diagram;if(null!==a&&!a.Xe){a.Xe=!0;var b=this.jk();mp(this,b,a,this);a.Xe=!1}};
function mp(a,b,c,d){for(var e=a.memberParts;e.next();){var f=e.value;f.Tb(!0);f instanceof yf&&f.wasSubGraphExpanded&&(f.wasSubGraphExpanded=!1,mp(f,b,c,d));if(f instanceof V)f.yd(b),c.Yj(f,d);else if(f instanceof R)for(f=f.labelNodes;f.next();)f.value.yd(b)}a.isSubGraphExpanded=!0}
yf.prototype.move=function(a,b){void 0===b&&(b=!1);var c=b?this.location:this.position,d=c.x;c=c.y;var e=a.x,f=a.y;if(!(d===e||isNaN(d)&&isNaN(e))||!(c===f||isNaN(c)&&isNaN(f))){d=e-(isNaN(d)?0:d);c=f-(isNaN(c)?0:c);f=K.alloc();V.prototype.move.call(this,a,b);a=new I;for(b=this.jk().iterator;b.next();)if(e=b.value,e instanceof R&&(e.suspendsRouting&&a.add(e),e.Ad||e.fromNode!==this&&e.toNode!==this))e.suspendsRouting=!0;for(b.reset();b.next();)if(e=b.value,!(e.Sh()||e instanceof V&&e.isLinkLabel)){var g=
e.position,h=e.location;g.s()?(f.x=g.x+d,f.y=g.y+c,e.position=f):h.s()&&(f.x=h.x+d,f.y=h.y+c,e.location=f)}for(b.reset();b.next();)if(e=b.value,e instanceof R&&(e.suspendsRouting=a.contains(e),e.Ad||e.fromNode!==this&&e.toNode!==this))g=e.position,f.x=g.x+d,f.y=g.y+c,f.s()?e.move(f):e.$a(),Tj(e)&&e.$a();K.free(f)}};
na.Object.defineProperties(yf.prototype,{placeholder:{configurable:!0,get:function(){return this.Sa}},computesBoundsAfterDrag:{configurable:!0,get:function(){return 0!==(this.U&2048)},set:function(a){var b=0!==(this.U&2048);b!==a&&(A(a,"boolean",yf,"computesBoundsAfterDrag"),this.U^=2048,this.g("computesBoundsAfterDrag",b,a))}},computesBoundsIncludingLinks:{configurable:!0,get:function(){return 0!==(this.U&4096)},set:function(a){A(a,"boolean",yf,"computesBoundsIncludingLinks");
var b=0!==(this.U&4096);b!==a&&(this.U^=4096,this.g("computesBoundsIncludingLinks",b,a))}},computesBoundsIncludingLocation:{configurable:!0,get:function(){return 0!==(this.U&8192)},set:function(a){A(a,"boolean",yf,"computesBoundsIncludingLocation");var b=0!==(this.U&8192);b!==a&&(this.U^=8192,this.g("computesBoundsIncludingLocation",b,a))}},handlesDragDropForMembers:{configurable:!0,get:function(){return 0!==(this.U&16384)},set:function(a){A(a,"boolean",yf,"handlesDragDropForMembers");
var b=0!==(this.U&16384);b!==a&&(this.U^=16384,this.g("handlesDragDropForMembers",b,a))}},memberParts:{configurable:!0,get:function(){return this.Fo.iterator}},layout:{configurable:!0,get:function(){return this.Kc},set:function(a){var b=this.Kc;if(b!==a){null!==a&&w(a,zi,yf,"layout");null!==b&&(b.diagram=null,b.group=null);this.Kc=a;var c=this.diagram;null!==a&&(a.diagram=c,a.group=this);null!==c&&(c.Zh=!0);this.g("layout",b,a);null!==c&&c.Lb()}}},memberAdded:{configurable:!0,
enumerable:!0,get:function(){return this.Eo},set:function(a){var b=this.Eo;b!==a&&(null!==a&&A(a,"function",yf,"memberAdded"),this.Eo=a,this.g("memberAdded",b,a))}},memberRemoved:{configurable:!0,get:function(){return this.Go},set:function(a){var b=this.Go;b!==a&&(null!==a&&A(a,"function",yf,"memberRemoved"),this.Go=a,this.g("memberRemoved",b,a))}},memberValidation:{configurable:!0,get:function(){return this.wi},set:function(a){var b=this.wi;b!==a&&(null!==a&&A(a,"function",
yf,"memberValidation"),this.wi=a,this.g("memberValidation",b,a))}},ungroupable:{configurable:!0,get:function(){return 0!==(this.U&256)},set:function(a){var b=0!==(this.U&256);b!==a&&(A(a,"boolean",yf,"ungroupable"),this.U^=256,this.g("ungroupable",b,a))}},isSubGraphExpanded:{configurable:!0,get:function(){return 0!==(this.U&512)},set:function(a){var b=0!==(this.U&512);if(b!==a){A(a,"boolean",yf,"isSubGraphExpanded");this.U^=512;var c=this.diagram;this.g("isSubGraphExpanded",
b,a);b=this.subGraphExpandedChanged;if(null!==b){var d=!0;null!==c&&(d=c.ba,c.ba=!0);b(this);null!==c&&(c.ba=d)}null!==c&&c.undoManager.isUndoingRedoing?(null!==this.Sa&&this.Sa.v(),this.memberParts.each(function(a){a.updateAdornments()})):a?this.expandSubGraph():this.collapseSubGraph()}}},wasSubGraphExpanded:{configurable:!0,get:function(){return 0!==(this.U&1024)},set:function(a){var b=0!==(this.U&1024);b!==a&&(A(a,"boolean",yf,"wasSubGraphExpanded"),this.U^=1024,this.g("wasSubGraphExpanded",
b,a))}},subGraphExpandedChanged:{configurable:!0,get:function(){return this.Jp},set:function(a){var b=this.Jp;b!==a&&(null!==a&&A(a,"function",yf,"subGraphExpandedChanged"),this.Jp=a,this.g("subGraphExpandedChanged",b,a))}},Uh:{configurable:!0,get:function(){return 0!==(this.U&32768)},set:function(a){0!==(this.U&32768)!==a&&(this.U^=32768)}}});yf.prototype.expandSubGraph=yf.prototype.expandSubGraph;yf.prototype.collapseSubGraph=yf.prototype.collapseSubGraph;
yf.prototype.findSubGraphParts=yf.prototype.jk;yf.prototype.findContainingGroupChain=yf.prototype.Zz;yf.prototype.findExternalNodesConnected=yf.prototype.$z;yf.prototype.findExternalLinksConnected=yf.prototype.av;yf.prototype.ensureBounds=yf.prototype.Ya;yf.className="Group";function ng(a){O.call(this);this.sb=zc;this.sp=new M(NaN,NaN,NaN,NaN);a&&Object.assign(this,a)}ma(ng,O);ng.prototype.cloneProtected=function(a){O.prototype.cloneProtected.call(this,a);a.sb=this.sb.L();a.sp=this.sp.copy()};
ng.prototype.Mh=function(a){if(null===this.background&&null===this.areaBackground)return!1;var b=this.naturalBounds;return jc(0,0,b.width,b.height,a.x,a.y)};
ng.prototype.um=function(){var a=this.part;null!==a&&(a instanceof yf||a instanceof Ke)||v("Placeholder is not inside a Group or Adornment.");if(a instanceof yf){var b=this.computeBorder(this.sp),c=this.minSize,d=this.Ac;ac(d,(isFinite(c.width)?Math.max(c.width,b.width):b.width)||0,(isFinite(c.height)?Math.max(c.height,b.height):b.height)||0);this.Ie(0,0,d.width,d.height);d=a.memberParts;for(c=!1;d.next();)if(d.value.isVisible()){c=!0;break}d=a.diagram;!c||null===d||d.animationManager.rv(a)||isNaN(b.x)||
isNaN(b.y)||(c=K.alloc(),c.ej(b,a.locationSpot),c.B(a.location)||(a.location=c),K.free(c))}else{b=this.Ac;c=this.sb;d=c.left+c.right;var e=c.top+c.bottom,f=a.adornedObject;a.angle=f.Vi();var g=0;f instanceof Kf&&(g=f.strokeWidth);var h=f.Mf(),k=f.naturalBounds,l=(k.width+g)*h;g=(k.height+g)*h;a.type!==X.Link&&(f=f.ja("Selection"===a.category?Cc:a.locationSpot,K.alloc()),a.location=f,K.free(f));isNaN(l)||isNaN(g)?(a=a.adornedObject,l=a.ja(Cc,K.alloc()),f=M.allocAt(l.x,l.y,0,0),f.af(a.ja(Nc,l)),f.af(a.ja(Gc,
l)),f.af(a.ja(Kc,l)),ac(b,f.width+d||0,f.height+e||0),this.Ie(-c.left,-c.top,b.width,b.height),K.free(l),M.free(f)):(ac(b,l+d||0,g+e||0),this.Ie(-c.left,-c.top,b.width,b.height))}};ng.prototype.Kh=function(a,b,c,d){this.actualBounds.h(a,b,c,d)};
ng.prototype.computeBorder=function(a){var b=this.part,c=b.diagram;if(null!==c&&b instanceof yf&&!b.layer.isTemporary&&b.computesBoundsAfterDrag&&this.sp.s()){var d=c.toolManager.findTool("Dragging");if(d===c.currentTool&&(c=d.computeBorder(b,this.sp,a),null!==c))return c}c=M.alloc();d=this.computeMemberBounds(c);var e=this.sb;b instanceof yf&&!b.isSubGraphExpanded?a.h(d.x-e.left,d.y-e.top,0,0):a.h(d.x-e.left,d.y-e.top,Math.max(d.width+e.left+e.right,0),Math.max(d.height+e.top+e.bottom,0));M.free(c);
b instanceof yf&&b.computesBoundsIncludingLocation&&b.location.s()&&a.af(b.location);return a};
ng.prototype.computeMemberBounds=function(a){if(!(this.part instanceof yf))return a.h(0,0,0,0),a;for(var b=this.part,c=Infinity,d=Infinity,e=-Infinity,f=-Infinity,g=b.memberParts;g.next();){var h=g.value;if(h.isVisible()){if(h instanceof R){if(!b.computesBoundsIncludingLinks)continue;if(vj(h))continue;if(h.fromNode===b||h.toNode===b)continue}h=h.actualBounds;h.left<c&&(c=h.left);h.top<d&&(d=h.top);h.right>e&&(e=h.right);h.bottom>f&&(f=h.bottom)}}isFinite(c)&&isFinite(d)?a.h(c,d,e-c,f-d):(b=b.location,
a.h(b.x,b.y,0,0));return a};na.Object.defineProperties(ng.prototype,{padding:{configurable:!0,get:function(){return this.sb},set:function(a){"number"===typeof a?a=new fc(a):w(a,fc,ng,"padding");var b=this.sb;b.B(a)||(this.sb=a=a.L(),this.g("padding",b,a),this.v())}}});ng.className="Placeholder";
function R(a){U.call(this,X.Link);this.Na=8;this.hf=null;this.jf="";this.Bf=this.Pn=null;this.Cf="";this.Pp=null;this.Gk=dg;this.tn=0;this.vn=dg;this.wn=NaN;this.Oj=np;this.Ep=.5;this.ud=null;this.Hb=(new H).freeze();this.uf=this.Mc=null;this.Jl=new M;this.sa=new N;this.F=this.o=this.Yf=this.bg=null;this.yu=new K;this.qr=this.yx=this.xx=null;this.Tt=NaN;this.T=null;this.j=[];a&&Object.assign(this,a)}ma(R,U);
R.prototype.cloneProtected=function(a){U.prototype.cloneProtected.call(this,a);a.Na=this.Na&-113;a.jf=this.jf;a.Pn=this.Pn;a.Cf=this.Cf;a.Pp=this.Pp;a.Gk=this.Gk;a.tn=this.tn;a.vn=this.vn;a.wn=this.wn;a.Oj=this.Oj;a.Ep=this.Ep;null!==this.T&&(a.T=this.T.copy())};t=R.prototype;t.If=function(a){U.prototype.If.call(this,a);this.jf=a.jf;this.Cf=a.Cf;a.Mc=null;a.$a();a.Yf=this.Yf;var b=a.fromPort;null!==b&&$o(b);a=a.toPort;null!==a&&$o(a)};
t.mb=function(a){a.classType===R?2===(a.value&2)?this.routing=a:a===gg||a===cg||a===bg?this.curve=a:a===op||a===pp||a===qp?this.adjusting=a:a!==np&&a!==dg&&v("Unknown Link enum value for a Link property: "+a):U.prototype.mb.call(this,a)};t.Rc=function(){null===this.T&&(this.T=new ll)};t.cj=function(){var a=this.fromNode;if(null!==a){var b=a.findVisibleNode();null!==b&&(a=b);if(wj(a)||xj(a))return!1}a=this.toNode;return null!==a&&(b=a.findVisibleNode(),null!==b&&(a=b),wj(a)||xj(a))?!1:!0};t.Xv=function(){return!1};
t.gt=function(){};t.Tc=function(){return!1};R.prototype.computeAngle=function(a,b,c){return R.computeAngle(b,c)};R.computeAngle=function(a,b){switch(a){default:case dg:a=0;break;case an:a=b;break;case Um:a=b+90;break;case Wm:a=b-90;break;case rp:a=b+180;break;case bn:a=L.wq(b);90<a&&270>a&&(a-=180);break;case Vm:a=L.wq(b+90);90<a&&270>a&&(a-=180);break;case Xm:a=L.wq(b-90);90<a&&270>a&&(a-=180);break;case Ym:a=L.wq(b);if(45<a&&135>a||225<a&&315>a)return 0;90<a&&270>a&&(a-=180)}return L.wq(a)};
function Wo(a){var b=a.fromNode,c=a.toNode,d=null;null!==b?d=null!==c?b.$x(c):b.containingGroup:null!==c?d=c.containingGroup:d=null;b=d;c=a.bi;if(c!==b){null!==c&&Ro(c,a);a.bi=b;null!==b&&Qo(b,a);var e=a.containingGroupChanged;if(null!==e){var f=!0,g=a.diagram;null!==g&&(f=g.ba,g.ba=!0);e(a,c,b);null!==g&&(g.ba=f)}!a.Ad||a.xx!==c&&a.yx!==c||a.$a()}if(a.isLabeledLink)for(a=a.labelNodes;a.next();)a.value.containingGroup=d}t=R.prototype;
t.Rh=function(){var a=this.containingGroup;null!==a&&this.fromNode!==a&&this.toNode!==a&&a.computesBoundsIncludingLinks&&U.prototype.Rh.call(this)};t.nq=function(a){G&&w(a,V,R,"getOtherNode:node");var b=this.fromNode;return a===b?this.toNode:b};t.sA=function(a){G&&w(a,O,R,"getOtherPort:port");var b=this.fromPort;return a===b?this.toPort:b};function dp(a,b){null===a.ud&&(a.ud=new I);a.ud.add(b);a.v()}
t.pq=function(a){U.prototype.pq.call(this,a);sp(this)&&this.rq(this.actualBounds);if(!a){a=this.hf;var b=null;null!==a&&(b=this.fromPort,bp(a,this,b));var c=this.Bf;if(null!==c){var d=this.toPort;c===a&&d===b||bp(c,this,d)}tp(this)}};t.qq=function(a){U.prototype.qq.call(this,a);sp(this)&&this.rq(this.actualBounds);if(!a){a=this.hf;var b=null;null!==a&&(b=this.fromPort,cp(a,this,b));var c=this.Bf;if(null!==c){var d=this.toPort;c===a&&d===b||cp(c,this,d)}up(this)}};
t.fk=function(){this.Ad=!0;if(null!==this.ud){var a=this.diagram;if(null!==a)for(var b=this.ud.copy().iterator;b.next();)a.remove(b.value)}null!==this.data&&(a=this.diagram,null!==a&&a.partManager.removeDataForLink(this))};R.prototype.updateRelationshipsFromData=function(){if(null!==this.data){var a=this.diagram;null!==a&&a.partManager.updateRelationshipsFromData(this)}};
R.prototype.move=function(a,b){var c=b?this.location:this.position,d=c.x;isNaN(d)&&(d=0);var e=c.y;isNaN(e)&&(e=0);d=a.x-d;e=a.y-e;!0===b?U.prototype.move.call(this,a,!1):(a=K.allocAt(c.x+d,c.y+e),U.prototype.move.call(this,a,!1),K.free(a));pf(this,d,e);for(a=this.labelNodes;a.next();)b=a.value,c=b.position,b.moveTo(c.x+d,c.y+e)};
R.prototype.canRelinkFrom=function(){if(!this.relinkableFrom)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowRelink)return!1;a=a.diagram;return null===a||a.allowRelink?!0:!1};R.prototype.canRelinkTo=function(){if(!this.relinkableTo)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowRelink)return!1;a=a.diagram;return null===a||a.allowRelink?!0:!1};
R.prototype.computeMidPoint=function(a){var b=this.pointsCount;if(0===b)return a.assign(Db),a;if(1===b)return a.assign(this.i(0)),a;if(2===b){var c=this.i(0),d=this.i(1);a.h((c.x+d.x)/2,(c.y+d.y)/2);return a}if(this.isOrthogonal&&(15<=this.computeCorner()||this.computeCurve()===gg))return this.sa.hv(.5,a),a.add(this.i(0)),c=this.sa.figures.first(),a.offset(-c.startX,-c.startY),a;if(this.computeCurve()===gg){if(3===b)return this.i(1);d=(b-1)/3|0;c=3*(d/2|0);if(1===d%2){d=this.i(c);var e=this.i(c+1),
f=this.i(c+2);c=this.i(c+3);L.Az(d.x,d.y,e.x,e.y,f.x,f.y,c.x,c.y,a)}else a.assign(this.i(c));return a}var g=this.flattenedLengths;c=this.flattenedTotalLength;for(e=f=d=0;d<c/2&&f<b;){e=g[f];if(d+e>c/2)break;d+=e;f++}b=this.i(f);f=this.i(f+1);1>Math.abs(b.x-f.x)?b.y>f.y?a.h(b.x,b.y-(c/2-d)):a.h(b.x,b.y+(c/2-d)):1>Math.abs(b.y-f.y)?b.x>f.x?a.h(b.x-(c/2-d),b.y):a.h(b.x+(c/2-d),b.y):(c=(c/2-d)/e,a.h(b.x+c*(f.x-b.x),b.y+c*(f.y-b.y)));return a};
R.prototype.computeMidAngle=function(){var a=this.pointsCount;if(2>a)return NaN;if(2===a)return this.i(0).Va(this.i(1));if(this.isOrthogonal&&(15<=this.computeCorner()||this.computeCurve()===gg))return this.sa.iy(.5);if(this.computeCurve()===gg&&4<=a){var b=(a-1)/3|0,c=3*(b/2|0);if(1===b%2){c=Math.floor(c);a=this.i(c);b=this.i(c+1);var d=this.i(c+2);c=this.i(c+3);return L.zz(a.x,a.y,b.x,b.y,d.x,d.y,c.x,c.y)}if(0<c&&c+1<a)return this.i(c-1).Va(this.i(c+1))}b=this.flattenedLengths;d=this.flattenedTotalLength;
var e=0;c=0;for(var f;e<d/2&&c<a;){f=b[c];if(e+f>d/2)break;e+=f;c++}b=this.i(c);d=this.i(c+1);if(1>Math.abs(b.x-d.x)&&1>Math.abs(b.y-d.y)){if(0<c&&c+2<a)return this.i(c-1).Va(this.i(c+2))}else{if(1>Math.abs(b.x-d.x))return b.y>d.y?270:90;if(1>Math.abs(b.y-d.y))return b.x>d.x?180:0}return b.Va(d)};t=R.prototype;t.i=function(a){return this.Hb.m[a]};
t.Wc=function(a,b){G&&(w(b,K,R,"setPoint"),b.s()||v("Link.setPoint called with a Point that does not have real numbers: "+b.toString()));G&&null===this.Mc&&v("Call Link.startRoute before modifying the points of the route.");this.Hb.Vc(a,b)};t.P=function(a,b,c){G&&(E(b,R,"setPointAt:x"),E(c,R,"setPointAt:y"));G&&null===this.Mc&&v("Call Link.startRoute before modifying the points of the route.");this.Hb.Vc(a,new K(b,c))};
t.BA=function(a,b){G&&(w(b,K,R,"insertPoint"),b.s()||v("Link.insertPoint called with a Point that does not have real numbers: "+b.toString()));G&&null===this.Mc&&v("Call Link.startRoute before modifying the points of the route.");this.Hb.Bb(a,b)};t.l=function(a,b,c){G&&(E(b,R,"insertPointAt:x"),E(c,R,"insertPointAt:y"));G&&null===this.Mc&&v("Call Link.startRoute before modifying the points of the route.");this.Hb.Bb(a,new K(b,c))};
t.me=function(a){G&&(w(a,K,R,"addPoint"),a.s()||v("Link.addPoint called with a Point that does not have real numbers: "+a.toString()));G&&null===this.Mc&&v("Call Link.startRoute before modifying the points of the route.");this.Hb.add(a)};t.Ff=function(a,b){G&&(E(a,R,"insertPointAt:x"),E(b,R,"insertPointAt:y"));G&&null===this.Mc&&v("Call Link.startRoute before modifying the points of the route.");this.Hb.add(new K(a,b))};
t.Ov=function(a){G&&null===this.Mc&&v("Call Link.startRoute before modifying the points of the route.");this.Hb.kb(a)};t.ak=function(){G&&null===this.Mc&&v("Call Link.startRoute before modifying the points of the route.");this.Hb.clear()};
function pf(a,b,c){if(0!==b||0!==c)if(0===a.pointsCount)a.defaultFromPoint&&a.defaultFromPoint.offset(b,c),a.defaultToPoint&&a.defaultToPoint.offset(b,c);else{for(var d=a.Ad,e=new H,f=a.Hb.iterator;f.next();){var g=f.value;e.add((new K(g.x+b,g.y+c)).freeze())}e.freeze();f=a.Hb;a.Hb=e;g=a.diagram;isNaN(b)||isNaN(c)||null!==g&&g.animationManager.yb?a.v():(a.hg.h(a.hg.x+b,a.hg.y+c),a.pa.h(a.pa.x+b,a.pa.y+c),Il(a));d?vp(a):(a.defaultFromPoint&&(a.defaultFromPoint=a.i(0)),a.defaultToPoint&&(a.defaultToPoint=
a.i(a.pointsCount-1)));null!==g&&g.animationManager.yb&&(b=g.animationManager,a.uf=e,b.Ll.add(a));a.g("points",f,e)}}t.Wh=function(){null===this.Mc&&(this.Mc=this.Hb,this.Hb=this.Hb.copy())};
t.Hf=function(){if(null!==this.Mc){for(var a=this.Mc,b=this.Hb,c=Infinity,d=Infinity,e=a.m,f=e.length,g=0;g<f;g++){var h=e[g];c=Math.min(h.x,c);d=Math.min(h.y,d)}h=g=Infinity;for(var k=b.m,l=k.length,m=0;m<l;m++){var n=k[m];g=Math.min(n.x,g);h=Math.min(n.y,h);n.freeze()}b.freeze();if(l===f)for(f=0;f<l;f++){if(m=e[f],n=k[f],m.x-c!==n.x-g||m.y-d!==n.y-h){this.lc(!0);break}}else this.lc(!0);this.Mc=null;c=this.diagram;null!==c&&c.animationManager.yb&&(c=c.animationManager,this.uf=b,c.Ll.add(this));vp(this);
this.g("points",a,b)}};t.Qv=function(){null!==this.Mc&&(this.Hb=this.Mc,this.Mc=null)};function vp(a){0===a.Hb.count?a.Ad=!1:(a.Ad=!0,a.qr=null,a.Tt=NaN,a.defaultFromPoint=a.i(0),a.defaultToPoint=a.i(a.pointsCount-1),wp(a,!1))}
t.$a=function(){if(!this.suspendsRouting){var a=this.diagram;if(a){if(a.Ts.contains(this)||a.undoManager.isUndoingRedoing)return;a=a.animationManager;if(a.isTicking&&!a.isAnimating)return;null!==this.uf&&!a.isTicking&&a.isAnimating&&(this.uf=null)}a=this.path;null!==a&&(this.Ad=!1,this.v(),a.v())}};
t.Gg=function(){if(!this.Ad&&!this.computingPoints){var a=!0;try{this.computingPoints=!0,this.Wh(),a=this.computePoints()}catch(b){this.computingPoints=!1,this.Qv()}finally{this.computingPoints=!1,a?this.Hf():this.Qv()}}};
R.prototype.computePoints=function(){if(null===this.diagram)return!1;var a=this.fromNode,b=null;null===a?(xp||(xp=new V,xp.desiredSize=Pb,xp.Ya()),this.defaultFromPoint&&(xp.location=this.defaultFromPoint,xp.Ya(),b=a=xp)):b=this.fromPort;if(null!==b&&!a.isVisible()){var c=a.findVisibleNode();null!==c&&c!==a?(a=c,b=c.port):a=c}this.xx=a;if(null===a||!a.location.s())return!1;for(;!(null===b||b.actualBounds.s()&&b.Rf());)b=b.panel;if(null===b)return!1;var d=this.toNode,e=null;null===d?(yp||(yp=new V,
yp.desiredSize=Pb,yp.Ya()),this.defaultToPoint&&(yp.location=this.defaultToPoint,yp.Ya(),e=d=yp)):e=this.toPort;null===e||d.isVisible()||(c=d.findVisibleNode(),null!==c&&c!==d?(d=c,e=c.port):d=c);this.yx=d;if(null===d||!d.location.s())return!1;for(;!(null===e||e.actualBounds.s()&&e.Rf());)e=e.panel;if(null===e)return!1;var f=this.pointsCount,g=this.computeSpot(!0,b);c=this.computeSpot(!1,e);var h=zp(g),k=zp(c),l=b===e&&null!==b,m=this.isOrthogonal,n=this.curve===gg;this.bg=l&&!m?n=!0:!1;var p=this.computeAdjusting()===
dg||l;if(!m&&!l&&h&&k){if(h=!1,!p&&3<=f&&(p=this.getLinkPoint(a,b,g,!0,!1,d,e),k=this.getLinkPoint(d,e,c,!1,!1,a,b),h=this.adjustPoints(0,p,f-1,k))&&(p=this.getLinkPoint(a,b,g,!0,!1,d,e),k=this.getLinkPoint(d,e,c,!1,!1,a,b),this.adjustPoints(0,p,f-1,k)),!h)if(this.ak(),n){f=this.getLinkPoint(a,b,g,!0,!1,d,e);p=this.getLinkPoint(d,e,c,!1,!1,a,b);h=p.x-f.x;k=p.y-f.y;l=this.computeCurviness();n=m=0;var r=f.x+h/3,q=f.y+k/3,u=r,x=q;L.A(k,0)?x=0<h?x-l:x+l:(m=-h/k,n=Math.sqrt(l*l/(m*m+1)),0>l&&(n=-n),u=
(0>k?-1:1)*n+r,x=m*(u-r)+q);r=f.x+2*h/3;q=f.y+2*k/3;var y=r,z=q;L.A(k,0)?z=0<h?z-l:z+l:(y=(0>k?-1:1)*n+r,z=m*(y-r)+q);this.ak();this.me(f);this.Ff(u,x);this.Ff(y,z);this.me(p);this.Wc(0,this.getLinkPoint(a,b,g,!0,!1,d,e));this.Wc(3,this.getLinkPoint(d,e,c,!1,!1,a,b))}else if(f=d,p=e,d=this.getLinkPoint(a,b,g,!0,!1,f,p),e=this.getLinkPoint(f,p,c,!1,!1,a,b),this.hasCurviness())p=e.x-d.x,c=e.y-d.y,g=this.computeCurviness(),a=d.x+p/2,b=d.y+c/2,f=a,h=b,L.A(c,0)?h=0<p?h-g:h+g:(p=-p/c,f=Math.sqrt(g*g/(p*
p+1)),0>g&&(f=-f),f=(0>c?-1:1)*f+a,h=p*(f-a)+b),this.me(d),this.Ff(f,h),this.me(e);else{this.me(d);this.me(e);h=M.alloc();b.Wi(h);k=h.ca(e);p.Wi(h);l=h.ca(d);if(k||l)g=b.ja(Ap(g),new K),this.Wc(0,this.getLinkPointFromPoint(a,b,g,e,!0,g)),c=p.ja(Ap(c),new K),this.Wc(1,this.getLinkPointFromPoint(f,p,c,d,!1,c));M.free(h)}}else{n=this.isAvoiding;p&&(m&&n||l)&&this.ak();var B=l?this.computeCurviness():0;n=this.getLinkPoint(a,b,g,!0,m,d,e);r=u=q=0;if(m||!h||l)x=this.computeEndSegmentLength(a,b,g,!0),r=
this.getLinkDirection(a,b,n,g,!0,m,d,e),l&&(h||g.B(c)||!m&&1===g.x+c.x&&1===g.y+c.y)&&(r-=m?90:30,0>B&&(r-=180)),0>r?r+=360:360<=r&&(r-=360),l&&(x+=Math.abs(B)*(m?1:2)),0===r?q=x:90===r?u=x:180===r?q=-x:270===r?u=-x:(q=x*Math.cos(r*Math.PI/180),u=x*Math.sin(r*Math.PI/180)),g.ec()&&l&&(x=b.ja(Ic,K.alloc()),y=K.allocAt(x.x+1E3*q,x.y+1E3*u),this.getLinkPointFromPoint(a,b,x,y,!0,n),K.free(x),K.free(y));x=this.getLinkPoint(d,e,c,!1,m,a,b);var D=z=y=0;if(m||!k||l){var C=this.computeEndSegmentLength(d,e,
c,!1);D=this.getLinkDirection(d,e,x,c,!1,m,a,b);l&&(k||g.B(c)||!m&&1===g.x+c.x&&1===g.y+c.y)&&(D+=m?0:30,0>B&&(D+=180));0>D?D+=360:360<=D&&(D-=360);l&&(C+=Math.abs(B)*(m?1:2));0===D?y=C:90===D?z=C:180===D?y=-C:270===D?z=-C:(y=C*Math.cos(D*Math.PI/180),z=C*Math.sin(D*Math.PI/180));c.ec()&&l&&(c=e.ja(Ic,K.alloc()),g=K.allocAt(c.x+1E3*y,c.y+1E3*z),this.getLinkPointFromPoint(d,e,c,g,!1,x),K.free(c),K.free(g))}c=n;if(m||!h||l)c=new K(n.x+q,n.y+u);g=x;if(m||!k||l)g=new K(x.x+y,x.y+z);!p&&!m&&h&&3<f&&this.adjustPoints(0,
n,f-2,g)?this.Wc(f-1,x):!p&&!m&&k&&3<f&&this.adjustPoints(1,c,f-1,x)?this.Wc(0,n):!p&&(m?6<=f:4<f)&&this.adjustPoints(1,c,f-2,g)?(this.Wc(0,n),this.Wc(f-1,x)):(this.ak(),this.me(n),(m||!h||l)&&this.me(c),m&&this.addOrthoPoints(c,r,g,D,a,d),(m||!k||l)&&this.me(g),this.me(x))}return!0};function Bp(a,b){Math.abs(b.x-a.x)>Math.abs(b.y-a.y)?(b.x>=a.x?b.x=a.x+9E9:b.x=a.x-9E9,b.y=a.y):(b.y>=a.y?b.y=a.y+9E9:b.y=a.y-9E9,b.x=a.x);return b}
R.prototype.getLinkPointFromPoint=function(a,b,c,d,e,f){void 0===f&&(f=new K);if(null===a||null===b)return f.assign(c),f;a.isVisible()||(e=a.findVisibleNode(),null!==e&&e!==a&&(b=e.port));a=null;e=b.panel;null===e||e.re()||(e=e.panel);if(null===e){e=d.x;d=d.y;var g=c.x;c=c.y}else{a=e.ne;e=1/(a.m11*a.m22-a.m12*a.m21);g=a.m22*e;var h=-a.m12*e,k=-a.m21*e,l=a.m11*e,m=e*(a.m21*a.dy-a.m22*a.dx),n=e*(a.m12*a.dx-a.m11*a.dy);e=d.x*g+d.y*k+m;d=d.x*h+d.y*l+n;g=c.x*g+c.y*k+m;c=c.x*h+c.y*l+n}b.kk(e,d,g,c,f);null!==
a&&f.transform(a);return f};function Cp(a,b){var c=b.cp;null===c&&(c=new Dp,c.port=b,c.node=b.part,b.cp=c);return Ep(c,a)}
R.prototype.getLinkPoint=function(a,b,c,d,e,f,g,h){void 0===h&&(h=new K);if(c.fb()&&!zp(c))return b.ja(c,h),h;if(c.Uc()){var k=Cp(this,b);if(null!==k){h.assign(k.uq);if(e&&this.routing===Fp){var l=Cp(this,g);if(null!==l&&k.jm<l.jm){k=K.alloc();l=K.alloc();var m=new M(b.ja(Cc,k),b.ja(Nc,l)),n=this.computeSpot(!d,g);a=this.getLinkPoint(f,g,n,!d,e,a,b,l);(c.Pf(Pc)||c.Pf(Qc))&&a.y>=m.y&&a.y<=m.y+m.height?h.y=a.y:(c.Pf(Oc)||c.Pf(Rc))&&a.x>=m.x&&a.x<=m.x+m.width&&(h.x=a.x);K.free(k);K.free(l)}}return h}}c=
b.ja(Ap(c),K.alloc());this.pointsCount>(e?6:2)?(g=d?this.i(1):this.i(this.pointsCount-2),e&&(g=Bp(c,g.copy()))):(k=this.computeSpot(!d,g),f=K.alloc(),g=g.ja(Ap(k),f),e&&(g=Bp(c,g)),K.free(f));this.getLinkPointFromPoint(a,b,c,g,d,h);K.free(c);return h};
R.prototype.getLinkDirection=function(a,b,c,d,e,f,g,h){a:if(d.fb())var k=d.x>d.y?d.x>1-d.y?0:d.x<1-d.y?270:315:d.x<d.y?d.x>1-d.y?90:d.x<1-d.y?180:135:.5>d.x?225:.5<d.x?45:0;else{if(d.Uc()&&(k=Cp(this,b),null!==k))switch(k.Hc){case 1:k=270;break a;case 2:k=180;break a;default:case 4:k=0;break a;case 8:k=90;break a}k=b.ja(Ic,K.alloc());this.pointsCount>(f?6:2)?(h=e?this.i(1):this.i(this.pointsCount-2),h=f?Bp(k,h.copy()):c):(c=K.alloc(),h=h.ja(Ic,c),K.free(c));c=Math.abs(h.x-k.x)>Math.abs(h.y-k.y)?h.x>=
k.x?0:180:h.y>=k.y?90:270;K.free(k);k=c}d.ec()&&g.Pd(a)&&(k+=180,360<=k&&(k-=360));if(zp(d))return k;a=b.Vi();if(0===a)return k;45<=a&&135>a?k+=90:135<=a&&225>a?k+=180:225<=a&&315>a&&(k+=270);360<=k&&(k-=360);return k};R.prototype.computeEndSegmentLength=function(a,b,c,d){if(null!==b&&c.Uc()&&(a=Cp(this,b),null!==a))return a.Yu;a=d?this.fromEndSegmentLength:this.toEndSegmentLength;null!==b&&isNaN(a)&&(a=d?b.fromEndSegmentLength:b.toEndSegmentLength);isNaN(a)&&(a=10);return a};
R.prototype.computeSpot=function(a,b){void 0===b&&(b=null);a?(a=b?b:this.fromPort,null===a?a=Ic:(b=this.fromSpot,b.Kb()&&(b=a.fromSpot),a=b===dd?Bc:b)):(a=b?b:this.toPort,null===a?a=Ic:(b=this.toSpot,b.Kb()&&(b=a.toSpot),a=b===dd?Bc:b));return a};function zp(a){return a===Bc||.5===a.x&&.5===a.y}function Ap(a){return.5===a.x&&.5===a.y?a:Ic}
R.prototype.computeOtherPoint=function(a,b){if(this.computeAdjusting()!==dg&&4<this.pointsCount)return this.computeMidPoint(new K);a=b.cp;a=null!==a?Ep(a,this):null;return null!==a?a.uq:b.ja(Ic)};R.prototype.computeShortLength=function(a){if(a){a=this.fromShortLength;if(isNaN(a)){var b=this.fromPort;null!==b&&(a=b.fromShortLength)}return isNaN(a)?0:a}a=this.toShortLength;isNaN(a)&&(b=this.toPort,null!==b&&(a=b.toShortLength));return isNaN(a)?0:a};
R.prototype.Lf=function(a,b,c,d,e,f){if(!1===this.pickable)return!1;void 0===b&&(b=null);void 0===c&&(c=null);var g=f;void 0===f&&(g=Jb.alloc(),g.reset());g.multiply(this.transform);if(this.Lh(a,g))return nn(this,b,c,e),void 0===f&&Jb.free(g),!0;if(this.Sc(a,g)){var h=!1;if(!this.isAtomic)for(var k=this.W.m,l=k.length;l--;){var m=k[l];if(m.visible||m===this.locationObject){var n=m.actualBounds,p=this.naturalBounds;if(!(n.x>p.width||n.y>p.height||0>n.x+n.width||0>n.y+n.height)){n=Jb.alloc();n.set(g);
if(m instanceof X)h=m.Lf(a,b,c,d,e,n);else if(this.path===m){if(m instanceof Kf)if(h=a,p=d,!1===m.pickable)h=!1;else if(n.multiply(m.transform),p)b:{var r=h,q=n;if(m.Lh(r,q))h=!0;else{if(void 0===q&&(q=m.transform,r.Te(m.actualBounds))){h=!0;break b}h=r.left;p=r.right;var u=r.top;r=r.bottom;var x=K.alloc(),y=K.alloc(),z=K.alloc(),B=Jb.alloc();B.set(q);B.zv(m.transform);B.Ns();y.x=p;y.y=u;y.transform(B);x.x=h;x.y=u;x.transform(B);q=!1;Hn(m,x,y,z)?q=!0:(x.x=p,x.y=r,x.transform(B),Hn(m,x,y,z)?q=!0:(y.x=
h,y.y=r,y.transform(B),Hn(m,x,y,z)?q=!0:(x.x=h,x.y=u,x.transform(B),Hn(m,x,y,z)&&(q=!0))));Jb.free(B);K.free(x);K.free(y);K.free(z);h=q}}else h=m.Lh(h,n)}else h=pl(m,a,d,n);h&&(p=m,null!==b&&(p=b(m)),p&&(null===c||c(p))&&e.add(p));Jb.free(n)}}}void 0===f&&Jb.free(g);return h||null!==this.background||null!==this.areaBackground}void 0===f&&Jb.free(g);return!1};
R.prototype.computeCurve=function(){if(null===this.bg){var a=this.fromPort,b=this.isOrthogonal;this.bg=null!==a&&a===this.toPort&&!b}return this.bg?gg:this.curve};R.prototype.computeCorner=function(){if(this.curve===gg)return 0;var a=this.corner;if(isNaN(a)||0>a)a=10;return a};
R.prototype.findMidLabel=function(){for(var a=this.path,b=this.W.m,c=b.length,d=0;d<c;d++){var e=b[d];if(e!==a&&!e.isPanelMain&&(-Infinity===e.segmentIndex||isNaN(e.segmentIndex)))return e}for(a=this.labelNodes;a.next();)if(b=a.value,-Infinity===b.segmentIndex||isNaN(b.segmentIndex))return b;return null};
R.prototype.computeSpacing=function(){if(!this.isVisible())return 0;var a=Gp;a=Math.max(a,this.computeThickness());var b=this.fromPort,c=this.toPort;if(null!==b&&null!==c){var d=this.findMidLabel();if(null!==d){var e=d.naturalBounds,f=d.margin,g=isNaN(e.width)?30:e.width*d.scale+f.left+f.right;e=isNaN(e.height)?14:e.height*d.scale+f.top+f.bottom;d=d.segmentOrientation;d===an||d===bn||d===rp?a=Math.max(a,e):d===Wm||d===Xm||d===Um||d===Vm?a=Math.max(a,g):(b=b.ja(Ic).Va(c.ja(Ic))/180*Math.PI,a=Math.max(a,
Math.abs(Math.sin(b)*g)+Math.abs(Math.cos(b)*e)+1));this.curve===gg&&(a*=1.333)}}return a};R.prototype.arrangeBundledLinks=function(a,b){if(b)for(b=0;b<a.length;b++){var c=a[b];c.computeAdjusting()===dg&&c.$a()}};
R.prototype.computeCurviness=function(){var a=this.curviness;if(isNaN(a)){a=Hp;var b=this.Yf;if(null!==b){for(var c=Na(),d=0,e=b.links,f=0;f<e.length;f++){var g=e[f].computeSpacing();c.push(g);d+=g}d=-d/2;for(f=0;f<e.length;f++){if(e[f]===this){a=d+c[f]/2;break}d+=c[f]}b.Ws===this.fromNode&&(a=-a);Pa(c)}}return a};R.prototype.computeThickness=function(){if(!this.isVisible())return 0;var a=this.path;return null!==a?Math.max(a.strokeWidth,1):1};
R.prototype.hasCurviness=function(){return!isNaN(this.curviness)||null!==this.Yf};
R.prototype.adjustPoints=function(a,b,c,d){var e=this.computeAdjusting();if(this.isOrthogonal){if(e===pp)return!1;e===qp&&(e=op)}switch(e){case pp:var f=this.i(a),g=this.i(c);if(!f.Za(b)||!g.Za(d)){e=f.x;f=f.y;var h=g.x-e,k=g.y-f,l=Math.sqrt(h*h+k*k);if(!L.da(l,0)){if(L.da(h,0))var m=0>k?-Math.PI/2:Math.PI/2;else m=Math.atan(k/Math.abs(h)),0>h&&(m=Math.PI-m);g=b.x;var n=b.y;h=d.x-g;var p=d.y-n;k=Math.sqrt(h*h+p*p);L.da(h,0)?p=0>p?-Math.PI/2:Math.PI/2:(p=Math.atan(p/Math.abs(h)),0>h&&(p=Math.PI-p));
l=k/l;m=p-m;this.Wc(a,b);for(a+=1;a<c;a++)b=this.i(a),h=b.x-e,k=b.y-f,b=Math.sqrt(h*h+k*k),L.da(b,0)||(L.da(h,0)?k=0>k?-Math.PI/2:Math.PI/2:(k=Math.atan(k/Math.abs(h)),0>h&&(k=Math.PI-k)),h=k+m,b*=l,this.P(a,g+b*Math.cos(h),n+b*Math.sin(h)));this.Wc(c,d)}}return!0;case qp:f=this.i(a);n=this.i(c);if(!f.Za(b)||!n.Za(d)){e=f.x;f=f.y;g=n.x;n=n.y;l=(g-e)*(g-e)+(n-f)*(n-f);h=b.x;m=b.y;k=d.x;p=d.y;var r=1;if(0!==k-h){var q=(p-m)/(k-h);r=Math.sqrt(1+1/(q*q))}else q=9E9;this.Wc(a,b);for(a+=1;a<c;a++){b=this.i(a);
var u=b.x,x=b.y,y=.5;0!==l&&(y=((e-u)*(e-g)+(f-x)*(f-n))/l);var z=e+y*(g-e),B=f+y*(n-f);b=Math.sqrt((u-z)*(u-z)+(x-B)*(x-B));x<q*(u-z)+B&&(b=-b);0<q&&(b=-b);u=h+y*(k-h);y=m+y*(p-m);0!==q?(b=u+b/r,this.P(a,b,y-(b-u)/q)):this.P(a,u,y+b)}this.Wc(c,d)}return!0;case op:a:{if(this.isOrthogonal&&(e=this.i(a),f=this.i(a+1),g=this.i(a+2),h=f.x,m=f.y,n=h,l=m,L.A(e.y,f.y)?L.A(f.x,g.x)?m=b.y:L.A(f.y,g.y)&&(h=b.x):L.A(e.x,f.x)&&(L.A(f.y,g.y)?h=b.x:L.A(f.x,g.x)&&(m=b.y)),this.P(a+1,h,m),e=this.i(c),f=this.i(c-
1),g=this.i(c-2),h=f.x,m=f.y,k=h,p=m,L.A(e.y,f.y)?L.A(f.x,g.x)?m=d.y:L.A(f.y,g.y)&&(h=d.x):L.A(e.x,f.x)&&(L.A(f.y,g.y)?h=d.x:L.A(f.x,g.x)&&(m=d.y)),this.P(c-1,h,m),Tj(this))){this.P(a+1,n,l);this.P(c-1,k,p);c=!1;break a}this.Wc(a,b);this.Wc(c,d);c=!0}return c;default:return!1}};
R.prototype.addOrthoPoints=function(a,b,c,d,e,f){0>b?b+=360:360<=b&&(b-=360);0>d?d+=360:360<=d&&(d-=360);var g=d;b=315<=b||45>b?0:45<=b&&135>b?90:135<=b&&225>b?180:270;d=315<=d||45>d?0:45<=d&&135>d?90:135<=d&&225>d?180:270;var h=e.actualBounds.copy(),k=f.actualBounds.copy();if(h.s()&&k.s()){h.Qc(Ip,Ip);k.Qc(Ip,Ip);h.af(a);k.af(c);var l=K.alloc(),m=K.alloc();if(0===b)if(c.x>a.x||270===d&&c.y<a.y&&k.right>a.x||90===d&&c.y>a.y&&k.right>a.x)l.h(c.x,a.y),m.h(c.x,(a.y+c.y)/2),180===d?(l.x=this.computeMidOrthoPosition(a.x,
a.y,c.x,c.y,!1),m.x=l.x,m.y=c.y):270===d&&c.y<a.y||90===d&&c.y>a.y?(l.x=a.x<k.left?this.computeMidOrthoPosition(a.x,a.y,k.left,c.y,!1):a.x<k.right&&(270===d&&a.y<k.top||90===d&&a.y>k.bottom)?this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1):k.right,m.x=l.x,m.y=c.y):0===d&&a.x<k.left&&a.y>k.top&&a.y<k.bottom&&(l.x=a.x,l.y=a.y<c.y?Math.min(c.y,k.top):Math.max(c.y,k.bottom),m.y=l.y);else{l.h(a.x,c.y);m.h((a.x+c.x)/2,c.y);if(180===d||90===d&&c.y<h.top||270===d&&c.y>h.bottom)180===d&&(k.ca(a)||h.ca(c))?
l.y=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0):c.y<a.y&&(180===d||90===d)?l.y=this.computeMidOrthoPosition(a.x,h.top,c.x,Math.max(c.y,k.bottom),!0):c.y>a.y&&(180===d||270===d)&&(l.y=this.computeMidOrthoPosition(a.x,h.bottom,c.x,Math.min(c.y,k.top),!0)),m.x=c.x,m.y=l.y;if(l.y>h.top&&l.y<h.bottom)if(c.x>=h.left&&c.x<=a.x||a.x<=k.right&&a.x>=c.x){if(90===d||270===d)l.h(Math.max((a.x+c.x)/2,a.x),a.y),m.h(l.x,c.y)}else l.y=270===d||(0===d||180===d)&&c.y<a.y?Math.min(c.y,0===d?h.top:Math.min(h.top,
k.top)):Math.max(c.y,0===d?h.bottom:Math.max(h.bottom,k.bottom)),m.x=c.x,m.y=l.y}else if(180===b)if(c.x<a.x||270===d&&c.y<a.y&&k.left<a.x||90===d&&c.y>a.y&&k.left<a.x)l.h(c.x,a.y),m.h(c.x,(a.y+c.y)/2),0===d?(l.x=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1),m.x=l.x,m.y=c.y):270===d&&c.y<a.y||90===d&&c.y>a.y?(l.x=a.x>k.right?this.computeMidOrthoPosition(a.x,a.y,k.right,c.y,!1):a.x>k.left&&(270===d&&a.y<k.top||90===d&&a.y>k.bottom)?this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1):k.left,m.x=l.x,
m.y=c.y):180===d&&a.x>k.right&&a.y>k.top&&a.y<k.bottom&&(l.x=a.x,l.y=a.y<c.y?Math.min(c.y,k.top):Math.max(c.y,k.bottom),m.y=l.y);else{l.h(a.x,c.y);m.h((a.x+c.x)/2,c.y);if(0===d||90===d&&c.y<h.top||270===d&&c.y>h.bottom)0===d&&(k.ca(a)||h.ca(c))?l.y=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0):c.y<a.y&&(0===d||90===d)?l.y=this.computeMidOrthoPosition(a.x,h.top,c.x,Math.max(c.y,k.bottom),!0):c.y>a.y&&(0===d||270===d)&&(l.y=this.computeMidOrthoPosition(a.x,h.bottom,c.x,Math.min(c.y,k.top),!0)),m.x=
c.x,m.y=l.y;if(l.y>h.top&&l.y<h.bottom)if(c.x<=h.right&&c.x>=a.x||a.x>=k.left&&a.x<=c.x){if(90===d||270===d)l.h(Math.min((a.x+c.x)/2,a.x),a.y),m.h(l.x,c.y)}else l.y=270===d||(0===d||180===d)&&c.y<a.y?Math.min(c.y,180===d?h.top:Math.min(h.top,k.top)):Math.max(c.y,180===d?h.bottom:Math.max(h.bottom,k.bottom)),m.x=c.x,m.y=l.y}else if(90===b)if(c.y>a.y||180===d&&c.x<a.x&&k.bottom>a.y||0===d&&c.x>a.x&&k.bottom>a.y)l.h(a.x,c.y),m.h((a.x+c.x)/2,c.y),270===d?(l.y=this.computeMidOrthoPosition(a.x,a.y,c.x,
c.y,!0),m.x=c.x,m.y=l.y):180===d&&c.x<a.x||0===d&&c.x>a.x?(l.y=a.y<k.top?this.computeMidOrthoPosition(a.x,a.y,c.x,k.top,!0):a.y<k.bottom&&(180===d&&a.x<k.left||0===d&&a.x>k.right)?this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0):k.bottom,m.x=c.x,m.y=l.y):90===d&&a.y<k.top&&a.x>k.left&&a.x<k.right&&(l.x=a.x<c.x?Math.min(c.x,k.left):Math.max(c.x,k.right),l.y=a.y,m.x=l.x);else{l.h(c.x,a.y);m.h(c.x,(a.y+c.y)/2);if(270===d||0===d&&c.x<h.left||180===d&&c.x>h.right)270===d&&(k.ca(a)||h.ca(c))?l.x=this.computeMidOrthoPosition(a.x,
a.y,c.x,c.y,!1):c.x<a.x&&(270===d||0===d)?l.x=this.computeMidOrthoPosition(h.left,a.y,Math.max(c.x,k.right),c.y,!1):c.x>a.x&&(270===d||180===d)&&(l.x=this.computeMidOrthoPosition(h.right,a.y,Math.min(c.x,k.left),c.y,!1)),m.x=l.x,m.y=c.y;if(l.x>h.left&&l.x<h.right)if(c.y>=h.top&&c.y<=a.y||a.y<=k.bottom&&a.y>=c.y){if(0===d||180===d)l.h(a.x,Math.max((a.y+c.y)/2,a.y)),m.h(c.x,l.y)}else l.x=180===d||(90===d||270===d)&&c.x<a.x?Math.min(c.x,90===d?h.left:Math.min(h.left,k.left)):Math.max(c.x,90===d?h.right:
Math.max(h.right,k.right)),m.x=l.x,m.y=c.y}else if(c.y<a.y||180===d&&c.x<a.x&&k.top<a.y||0===d&&c.x>a.x&&k.top<a.y)l.h(a.x,c.y),m.h((a.x+c.x)/2,c.y),90===d?(l.y=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0),m.x=c.x,m.y=l.y):180===d&&c.x<a.x||0===d&&c.x>=a.x?(l.y=a.y>k.bottom?this.computeMidOrthoPosition(a.x,a.y,c.x,k.bottom,!0):a.y>k.top&&(180===d&&a.x<k.left||0===d&&a.x>k.right)?this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0):k.top,m.x=c.x,m.y=l.y):270===d&&a.y>k.bottom&&a.x>k.left&&a.x<k.right&&
(l.x=a.x<c.x?Math.min(c.x,k.left):Math.max(c.x,k.right),l.y=a.y,m.x=l.x);else{l.h(c.x,a.y);m.h(c.x,(a.y+c.y)/2);if(90===d||0===d&&c.x<h.left||180===d&&c.x>h.right)90===d&&(k.ca(a)||h.ca(c))?l.x=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1):c.x<a.x&&(90===d||0===d)?l.x=this.computeMidOrthoPosition(h.left,a.y,Math.max(c.x,k.right),c.y,!1):c.x>a.x&&(90===d||180===d)&&(l.x=this.computeMidOrthoPosition(h.right,a.y,Math.min(c.x,k.left),c.y,!1)),m.x=l.x,m.y=c.y;if(l.x>h.left&&l.x<h.right)if(c.y<=h.bottom&&
c.y>=a.y||a.y>=k.top&&a.y<=c.y){if(0===d||180===d)l.h(a.x,Math.min((a.y+c.y)/2,a.y)),m.h(c.x,l.y)}else l.x=180===d||(90===d||270===d)&&c.x<a.x?Math.min(c.x,270===d?h.left:Math.min(h.left,k.left)):Math.max(c.x,270===d?h.right:Math.max(h.right,k.right)),m.x=l.x,m.y=c.y}var n=c;if(this.isAvoiding){var p=this.diagram;if(null===p||e===f||this.layer.isTemporary||!lk(p)||h.ca(n)&&!f.Pd(e)||k.ca(a)&&!e.Pd(f))b=!1;else{var r=mk(p,!0,this.containingGroup,null);if(17!==this.segmentIndex&&r.pk(Math.min(a.x,l.x),
Math.min(a.y,l.y),Math.abs(a.x-l.x),Math.abs(a.y-l.y))&&r.pk(Math.min(l.x,m.x),Math.min(l.y,m.y),Math.abs(l.x-m.x),Math.abs(l.y-m.y))&&r.pk(Math.min(m.x,n.x),Math.min(m.y,n.y),Math.abs(m.x-n.x),Math.abs(m.y-n.y)))b=!1;else{e=a;f=n;var q=c=null;if(p.isVirtualized){p=r.bounds.copy();p.Qc(-r.cq,-r.bq);var u=K.alloc();Bk(r,a.x,a.y)||(L.Of(p.x,p.y,p.x+p.width,p.y+p.height,a.x,a.y,l.x,l.y,u)?(c=a=u.copy(),b=u.Va(l)):L.Of(p.x,p.y,p.x+p.width,p.y+p.height,l.x,l.y,m.x,m.y,u)?(c=a=u.copy(),b=u.Va(m)):L.Of(p.x,
p.y,p.x+p.width,p.y+p.height,m.x,m.y,n.x,n.y,u)&&(c=a=u.copy(),b=u.Va(n)));Bk(r,n.x,n.y)||(L.Of(p.x,p.y,p.x+p.width,p.y+p.height,n.x,n.y,m.x,m.y,u)?(q=n=u.copy(),d=m.Va(u)):L.Of(p.x,p.y,p.x+p.width,p.y+p.height,m.x,m.y,l.x,l.y,u)?(q=n=u.copy(),d=l.Va(u)):L.Of(p.x,p.y,p.x+p.width,p.y+p.height,l.x,l.y,a.x,a.y,u)&&(q=n=u.copy(),d=a.Va(u)));K.free(u)}h=h.copy().Xc(k);h.Qc(r.cq*r.Py,r.bq*r.Py);Jp(r,a,b,n,d,h,!0);k=Kp(r,n.x,n.y);!r.abort&&k>=Lp&&(Ak(r),h.Qc(r.cq*r.wy,r.bq*r.wy),Jp(r,a,b,n,d,h,!1),k=Kp(r,
n.x,n.y));if(!r.abort&&k<Lp&&Kp(r,n.x,n.y)!==Ck){Mp(this,r,n.x,n.y,d,!0,g);h=this.i(2);if(4>this.pointsCount)0===b||180===b?(h.x=a.x,h.y=n.y):(h.x=n.x,h.y=a.y),this.P(2,h.x,h.y),this.l(3,h.x,h.y);else if(g=this.i(3),0===b||180===b)L.A(h.x,g.x)?(h=0===b?Math.max(h.x,a.x):Math.min(h.x,a.x),this.P(2,h,a.y),this.P(3,h,g.y)):L.A(h.y,g.y)?(Math.abs(a.y-h.y)<=r.bq/2&&(this.P(2,h.x,a.y),this.P(3,g.x,a.y)),this.l(2,h.x,a.y)):this.P(2,a.x,h.y);else if(90===b||270===b)L.A(h.y,g.y)?(h=90===b?Math.max(h.y,a.y):
Math.min(h.y,a.y),this.P(2,a.x,h),this.P(3,g.x,h)):L.A(h.x,g.x)?(Math.abs(a.x-h.x)<=r.cq/2&&(this.P(2,a.x,h.y),this.P(3,a.x,g.y)),this.l(2,a.x,h.y)):this.P(2,h.x,a.y);null!==c&&(a=this.i(1),g=this.i(2),a.x!==g.x&&a.y!==g.y?0===b||180===b?this.l(2,a.x,g.y):this.l(2,g.x,a.y):0===b||180===b?this.l(2,e.x,c.y):this.l(2,c.x,e.y));null!==q&&(0===d||180===d?this.Ff(f.x,q.y):this.Ff(q.x,f.y));b=!0}else b=!1}}}else b=!1;b||(this.me(l.copy()),this.me(m.copy()));K.free(l);K.free(m)}};
R.prototype.computeMidOrthoPosition=function(a,b,c,d,e){var f=0;!this.hasCurviness()||this.computeSpot(!0,this.fromPort).Uc()||this.computeSpot(!1,this.toPort).Uc()||(f=this.computeCurviness());return e?(b+d)/2+f:(a+c)/2+f};
function Tj(a){if(null===a.diagram||!a.isAvoiding||!lk(a.diagram))return!1;var b=a.points.m,c=b.length;if(4>c)return!1;a=mk(a.diagram,!0,a.containingGroup,null);for(var d=1;d<c-2;d++){var e=b[d],f=b[d+1];if(!a.pk(Math.min(e.x,f.x),Math.min(e.y,f.y),Math.abs(e.x-f.x),Math.abs(e.y-f.y)))return!0}return!1}
function Mp(a,b,c,d,e,f,g){var h=b.cq,k=b.bq,l=Kp(b,c,d),m=c,n=d;0===e?m+=h:90===e?n+=k:180===e?m-=h:n-=k;e!==g&&l>Np&&Kp(b,m,n)!==l-1&&(Kp(b,c-h,d)===l-1?(e=180,m=c-h,n=d):Kp(b,c+h,d)===l-1?(e=0,m=c+h,n=d):Kp(b,c,d-k)===l-1?(e=270,m=c,n=d-k):Kp(b,c,d+k)===l-1&&(e=90,m=c,n=d+k));for(;l>Np&&Kp(b,m,n)===l-1;)c=m,d=n,0===e?m+=h:90===e?n+=k:180===e?m-=h:n-=k,--l;if(f){if(l>Np)if(180===e||0===e)c=Math.floor(c/h)*h+h/2;else if(90===e||270===e)d=Math.floor(d/k)*k+k/2}else c=Math.floor(c/h)*h+h/2,d=Math.floor(d/
k)*k+k/2;l>Np&&(f=e,g=c,m=d,0===e?(f=90,m+=k):90===e?(f=180,g-=h):180===e?(f=270,m-=k):270===e&&(f=0,g+=h),Kp(b,g,m)===l-1?Mp(a,b,g,m,f,!1,f):(g=c,m=d,0===e?(f=270,m-=k):90===e?(f=0,g+=h):180===e?(f=90,m+=k):270===e&&(f=180,g-=h),Kp(b,g,m)===l-1&&Mp(a,b,g,m,f,!1,f)));a.Ff(c,d)}
R.prototype.Wz=function(a){G&&w(a,K,R,"findClosestSegment:p");var b=a.x;a=a.y;for(var c=this.i(0),d=this.i(1),e=Lb(b,a,c.x,c.y,d.x,d.y),f=0,g=1;g<this.pointsCount-1;g++){c=this.i(g+1);var h=Lb(b,a,d.x,d.y,c.x,c.y);d=c;h<e&&(f=g,e=h)}return f};R.prototype.lc=function(a){this.Pm=!1;a&&this.v()};
R.prototype.rk=function(a){if(!a){if(!1===this.Ad)return;a=this.ub();if(this.Pm&&(null===a||null!==a.geometry))return}this.sa=this.makeGeometry();a=this.path;if(null!==a){a.sa=this.sa;for(var b=this.W.m,c=b.length,d=0;d<c;d++){var e=b[d];e!==a&&e.isPanelMain&&e instanceof Kf&&(e.sa=this.sa)}}};
R.prototype.makeGeometry=function(){var a=this.sa,b=this.pointsCount;if(2>b)return a.type=N.j,this.Pm=!0,a;var c=!1,d=this.diagram;null!==d&&sp(this)&&d.hi.contains(this)&&(0!==this.Jl.width||0!==this.Jl.height)&&(c=!0);var e=this.i(0).copy(),f=e.copy();d=this.Hb.m;var g=this.computeCurve();if(g===gg&&3<=b&&!L.da(this.smoothness,0))if(3===b){var h=this.i(1);d=Math.min(e.x,h.x);var k=Math.min(e.y,h.y);h=this.i(2);d=Math.min(d,h.x);k=Math.min(k,h.y)}else{if(this.isOrthogonal)for(k=0;k<b;k++)h=d[k],
f.x=Math.min(h.x,f.x),f.y=Math.min(h.y,f.y);else for(d=3;d<b;d+=3)d+3>=b&&(d=b-1),k=this.i(d),f.x=Math.min(k.x,f.x),f.y=Math.min(k.y,f.y);d=f.x;k=f.y}else{for(k=0;k<b;k++)h=d[k],f.x=Math.min(h.x,f.x),f.y=Math.min(h.y,f.y);d=f.x;k=f.y}d-=this.yu.x;k-=this.yu.y;e.x-=d;e.y-=k;if(2!==b||sp(this)){a.type=N.o;h=Ed(a);0!==this.computeShortLength(!0)&&(e=Op(this,e,!0,f));Fd(h,e.x,e.y,!1);if(g===gg&&3<=b&&!L.da(this.smoothness,0))if(3===b)c=this.i(1),b=c.x-d,c=c.y-k,e=this.i(2).copy(),e.x-=d,e.y-=k,0!==this.computeShortLength(!1)&&
(e=Op(this,e,!1,f)),Gd(h,b,c,b,c,e.x,e.y);else if(this.isOrthogonal){b=K.allocAt(d,k);c=K.alloc();c.assign(this.i(1));f=K.allocAt(d,k);e=K.allocAt(d,k);g=this.i(0);for(var l,m=this.smoothness/3,n=1;n<this.pointsCount-1;n++){l=this.i(n);var p=g,r=l,q=this.i(Pp(this,l,n,!1));if(!L.da(p.x,r.x)||!L.da(r.x,q.x))if(!L.da(p.y,r.y)||!L.da(r.y,q.y)){var u=m;isNaN(u)&&(u=this.smoothness/3);var x=p.x;p=p.y;var y=r.x;r=r.y;var z=q.x;q=q.y;var B=u*Qp(x,p,y,r);u*=Qp(y,r,z,q);L.da(p,r)&&L.da(y,z)&&(y>x?q>r?(f.x=
y-B,f.y=r-B,e.x=y+u,e.y=r+u):(f.x=y-B,f.y=r+B,e.x=y+u,e.y=r-u):q>r?(f.x=y+B,f.y=r-B,e.x=y-u,e.y=r+u):(f.x=y+B,f.y=r+B,e.x=y-u,e.y=r-u));L.da(x,y)&&L.da(r,q)&&(r>p?(z>y?(f.x=y-B,f.y=r-B,e.x=y+u):(f.x=y+B,f.y=r-B,e.x=y-u),e.y=r+u):(z>y?(f.x=y-B,f.y=r+B,e.x=y+u):(f.x=y+B,f.y=r+B,e.x=y-u),e.y=r-u));if(L.da(x,y)&&L.da(y,z)||L.da(p,r)&&L.da(r,q))x=.5*(x+z),p=.5*(p+q),f.x=x,f.y=p,e.x=x,e.y=p;1===n?(c.x=.5*(g.x+l.x),c.y=.5*(g.y+l.y)):2===n&&L.da(g.x,this.i(0).x)&&L.da(g.y,this.i(0).y)&&(c.x=.5*(g.x+l.x),
c.y=.5*(g.y+l.y));Gd(h,c.x-d,c.y-k,f.x-d,f.y-k,l.x-d,l.y-k);b.set(f);c.set(e);g=l}}l=g.x;g=g.y;m=this.i(this.pointsCount-1);0!==this.computeShortLength(!1)&&(m=Op(this,m.copy(),!1,zb));l=.5*(l+m.x);g=.5*(g+m.y);Gd(h,e.x-d,e.y-k,l-d,g-k,m.x-d,m.y-k);K.free(b);K.free(c);K.free(f);K.free(e)}else for(c=3;c<b;c+=3)f=this.i(c-2),c+3>=b&&(c=b-1),e=this.i(c-1),g=this.i(c),c===b-1&&0!==this.computeShortLength(!1)&&(g=Op(this,g.copy(),!1,zb)),Gd(h,f.x-d,f.y-k,e.x-d,e.y-k,g.x-d,g.y-k);else{f=K.alloc();f.assign(this.i(0));
e=K.alloc();e.assign(f);g=this.computeCorner();n=1;for(l=0;n<b;){n=Pp(this,f,n,1<n);m=this.i(n);if(n>=b-1){if(!f.B(m))0!==this.computeShortLength(!1)&&(m=Op(this,m.copy(),!1,zb)),Rp(this,h,-d,-k,f,m,c);else if(0===l)for(n=1;n<b;)e.assign(f),m=this.i(n++),Rp(this,h,-d,-k,f,m,c),f.assign(m);break}l=Pp(this,m,n+1,n<b-3);n=-d;x=-k;p=m;y=this.i(l);u=c;if(L.A(f.y,p.y)&&L.A(p.x,y.x))if(q=Math.min(g,Math.abs(p.x-e.x)/2),q=B=Math.min(q,Math.abs(y.y-p.y)/2),L.A(q,0))Rp(this,h,n,x,f,p,u),f.assign(p);else{var D=
p.x,C=p.y;r=D;z=C;p.x>f.x?D=p.x-q:D=p.x+q;y.y>p.y?z=p.y+B:z=p.y-B;y=K.allocAt(D,C);Rp(this,h,n,x,f,y,u);K.free(y);Hd(h,p.x+n,p.y+x,r+n,z+x);f.h(r,z)}else L.A(f.x,p.x)&&L.A(p.y,y.y)?(q=Math.min(g,Math.abs(p.y-e.y)/2),q=B=Math.min(q,Math.abs(y.x-p.x)/2),L.A(B,0)?(Rp(this,h,n,x,f,p,u),f.assign(p)):(D=p.x,C=p.y,r=D,z=C,p.y>f.y?C=p.y-q:C=p.y+q,y.x>p.x?r=p.x+B:r=p.x-B,y=K.allocAt(D,C),Rp(this,h,n,x,f,y,u),K.free(y),Hd(h,p.x+n,p.y+x,r+n,z+x),f.h(r,z))):(Rp(this,h,n,x,f,p,u),f.assign(p));e.assign(m);n=l}K.free(f)}Od=
h}else h=this.i(1).copy(),h.x-=d,h.y-=k,0!==this.computeShortLength(!0)&&(e=Op(this,e,!0,f)),0!==this.computeShortLength(!1)&&(h=Op(this,h,!1,f)),a.type=N.j,a.startX=e.x,a.startY=e.y,a.endX=h.x,a.endY=h.y;this.Pm=!0;return a};function Qp(a,b,c,d){a=c-a;if(isNaN(a)||Infinity===a||-Infinity===a)return NaN;0>a&&(a=-a);b=d-b;if(isNaN(b)||Infinity===b||-Infinity===b)return NaN;0>b&&(b=-b);return L.da(a,0)?b:L.da(b,0)?a:Math.sqrt(a*a+b*b)}
function Op(a,b,c,d){var e=a.pointsCount;if(2>e)return b;if(c){var f=a.i(1);c=f.x-d.x;f=f.y-d.y;d=Qp(b.x,b.y,c,f);if(0===d)return b;e=2===e?.5*d:d;a=a.computeShortLength(!0);a>e&&(a=e);e=a*(f-b.y)/d;b.x+=a*(c-b.x)/d;b.y+=e}else{f=a.i(e-2);c=f.x-d.x;f=f.y-d.y;d=Qp(b.x,b.y,c,f);if(0===d)return b;e=2===e?.5*d:d;a=a.computeShortLength(!1);a>e&&(a=e);e=a*(b.y-f)/d;b.x-=a*(b.x-c)/d;b.y-=e}return b}
function Pp(a,b,c,d){for(var e=a.pointsCount,f=b;L.da(b.x,f.x)&&L.da(b.y,f.y);){if(c>=e)return e-1;f=a.i(c++)}if(!L.da(b.x,f.x)&&!L.da(b.y,f.y))return c-1;for(var g=f;L.da(b.x,f.x)&&L.da(f.x,g.x)&&(!d||(b.y>=f.y?f.y>=g.y:f.y<=g.y))||L.da(b.y,f.y)&&L.da(f.y,g.y)&&(!d||(b.x>=f.x?f.x>=g.x:f.x<=g.x));){if(c>=e)return e-1;g=a.i(c++)}return c-2}R.prototype.computeJumpLength=function(){return 10};
function Rp(a,b,c,d,e,f,g){if(!g&&sp(a)){g=a.computeJumpLength();var h=g/2,k=[],l=0;a.isVisible()&&(l=Sp(a,e,f,k));if(0<l)if(L.A(e.y,f.y))if(e.x<f.x)for(var m=0;m<l;){var n=Math.max(e.x,Math.min(k[m++]-h,f.x-g));b.lineTo(n+c,f.y+d);var p=n+c;for(var r=Math.min(n+g,f.x);m<l;)if(n=k[m],n<r+g)m++,r=Math.min(n+h,f.x);else break;n=f.y-g+d;r+=c;var q=f.y+d;a.curve===cg?Fd(b,r,q,!1):Gd(b,p,n,r,n,r,q)}else for(--l;0<=l;){m=Math.min(e.x,Math.max(k[l--]+h,f.x+g));b.lineTo(m+c,f.y+d);p=m+c;for(n=Math.max(m-
g,f.x);0<=l;)if(m=k[l],m>n-g)l--,n=Math.max(m-h,f.x);else break;m=f.y-g+d;n+=c;r=f.y+d;a.curve===cg?Fd(b,n,r,!1):Gd(b,p,m,n,m,n,r)}else if(L.A(e.x,f.x))if(e.y<f.y)for(m=0;m<l;){n=Math.max(e.y,Math.min(k[m++]-h,f.y-g));b.lineTo(f.x+c,n+d);p=n+d;for(n=Math.min(n+g,f.y);m<l;)if(r=k[m],r<n+g)m++,n=Math.min(r+h,f.y);else break;r=f.x-g+c;q=f.x+c;n+=d;a.curve===cg?Fd(b,q,n,!1):Gd(b,r,p,r,n,q,n)}else for(--l;0<=l;){m=Math.min(e.y,Math.max(k[l--]+h,f.y+g));b.lineTo(f.x+c,m+d);p=m+d;for(m=Math.max(m-g,f.y);0<=
l;)if(n=k[l],n>m-g)l--,m=Math.max(n-h,f.y);else break;n=f.x-g+c;r=f.x+c;m+=d;a.curve===cg?Fd(b,r,m,!1):Gd(b,n,p,n,m,r,m)}}b.lineTo(f.x+c,f.y+d)}
function Sp(a,b,c,d){var e=a.diagram;if(null===e||b.B(c))return 0;for(e=e.layers;e.next();){var f=e.value;if(null!==f&&f.visible){f=f.Ma.m;for(var g=f.length,h=0;h<g;h++){var k=f[h];if(k instanceof R){if(k===a)return 0<d.length&&d.sort(function(a,b){return a-b}),d.length;if(k.isVisible()&&sp(k)){var l=k.routeBounds;l.s()&&a.routeBounds.Sc(l)&&!a.usesSamePort(k)&&(l=k.path,null!==l&&l.Rf()&&Tp(b,c,d,k))}}}}}0<d.length&&d.sort(function(a,b){return a-b});return d.length}
function Tp(a,b,c,d){for(var e=L.A(a.y,b.y),f=d.pointsCount,g=d.i(0),h=K.alloc(),k=1;k<f;k++){var l=d.i(k);if(k<f-1){var m=d.i(k+1);if(g.y===l.y&&l.y===m.y){if(l.x>g.x&&m.x>=l.x||l.x<g.x&&m.x<=l.x)continue}else if(g.x===l.x&&l.x===m.x&&(l.y>g.y&&m.y>=l.y||l.y<g.y&&m.y<=l.y))continue}a:{m=a.x;var n=a.y,p=b.x,r=b.y,q=g.x;g=g.y;var u=l.x,x=l.y;if(!L.A(m,p)){if(L.A(n,r)&&L.A(q,u)&&Math.min(m,p)<q&&Math.max(m,p)>q&&Math.min(g,x)<n&&Math.max(g,x)>n&&!L.A(g,x)){h.x=q;h.y=n;m=!0;break a}}else if(!L.A(n,r)&&
L.A(g,x)&&Math.min(n,r)<g&&Math.max(n,r)>g&&Math.min(q,u)<m&&Math.max(q,u)>m&&!L.A(q,u)){h.x=m;h.y=g;m=!0;break a}h.x=0;h.y=0;m=!1}m&&(e?c.push(h.x):c.push(h.y));g=l}K.free(h)}function sp(a){a=a.curve;return a===bg||a===cg}function wp(a,b){if(b||sp(a))b=a.diagram,null===b||b.animationManager.isTicking||b.hi.contains(a)||0===a.Jl.width&&0===a.Jl.height||b.hi.add(a,a.Jl.copy())}
R.prototype.rq=function(a){var b=this.layer;if(null!==b&&b.visible&&!b.isTemporary){var c=b.diagram;if(null!==c&&!c.animationManager.isTicking){var d=!1;for(c=c.layers;c.next();){var e=c.value;if(e.visible)if(e===b){d=!0;var f=!1;e=e.Ma.m;for(var g=e.length,h=0;h<g;h++){var k=e[h];k instanceof R&&(k===this?f=!0:f&&Up(this,k,a))}}else if(d)for(f=e.Ma.m,e=f.length,g=0;g<e;g++)h=f[g],h instanceof R&&Up(this,h,a)}}}};
function Up(a,b,c){if(null!==b&&b.Pm&&b.Ad&&sp(b)){var d=b.routeBounds;d.s()&&(a.routeBounds.Sc(d)||c.Sc(d))&&(a.usesSamePort(b)||b.lc(!1))}}R.prototype.usesSamePort=function(a){var b=this.pointsCount,c=a.pointsCount;if(0<b&&0<c){var d=this.i(0),e=a.i(0);if(d.Za(e))return!0;b=this.i(b-1);a=a.i(c-1);if(b.Za(a)||d.Za(a)||b.Za(e))return!0}else if(this.fromNode===a.fromNode||this.toNode===a.toNode||this.fromNode===a.toNode||this.toNode===a.fromNode)return!0;return!1};
R.prototype.isVisible=function(){if(!U.prototype.isVisible.call(this))return!1;var a=this.containingGroup,b=!0,c=this.diagram;null!==c&&(b=c.isTreePathToChildren);c=this.fromNode;if(null!==c){if(this.isTreeLink&&b&&!c.isTreeExpanded)return!1;if(c===a)return!0;for(var d=c;null!==d;){if(d.labeledLink===this)return!0;d=d.containingGroup}c=c.findVisibleNode();if(null===c||c===a)return!1}c=this.toNode;if(null!==c){if(this.isTreeLink&&!b&&!c.isTreeExpanded)return!1;if(c===a)return!0;for(b=c;null!==b;){if(b.labeledLink===
this)return!0;b=b.containingGroup}b=c.findVisibleNode();if(null===b||b===a)return!1}return!0};R.prototype.Tb=function(a){U.prototype.Tb.call(this,a);null!==this.Yf&&this.Yf.qm();if(null!==this.ud)for(var b=this.ud.iterator;b.next();)b.value.Tb(a)};R.prototype.computeAdjusting=function(){return this.isAvoiding&&null!==this.diagram&&this.diagram.animationManager.defaultAnimation.isAnimating?op:this.Gk};
function tp(a){var b=a.hf;if(null!==b){var c=a.Bf;if(null!==c&&isNaN(a.curviness)){for(var d=a.jf,e=a.Cf,f=a=null,g=b.ib.m,h=g.length,k=0;k<h;k++){var l=g[k];if(l.hf===b&&l.jf===d&&l.Bf===c&&l.Cf===e||l.hf===c&&l.jf===e&&l.Bf===b&&l.Cf===d)null===f?f=l:(null===a&&(a=[],a.push(f)),a.push(l))}if(null!==a){f=Zo(b,c,d,e);null===f&&(f=new Vp(b,d,c,e),Yo(b,f),Yo(c,f));f.links=a;for(b=0;b<a.length;b++)a[b].Yf=f;f.qm()}}}}
function up(a){var b=a.Yf;null!==b&&isNaN(a.curviness)&&(a.Yf=null,a=b.links.indexOf(a),0<=a&&(La(b.links,a),b.qm()))}R.prototype.Sh=function(){return!0};
na.Object.defineProperties(R.prototype,{fromNode:{configurable:!0,get:function(){return this.hf},set:function(a){var b=this.hf;if(b!==a){G&&null!==a&&w(a,V,R,"fromNode");var c=this.fromPort;null!==b&&(this.Bf!==b&&cp(b,this,c),up(this),this.C(2));this.hf=a;null!==a&&this.Tb(a.isVisible());this.bg=null;this.$a();var d=this.diagram;null!==d&&d.ba&&d.partManager.setFromNodeForLink(this,a,b);var e=this.fromPort,f=this.fromPortChanged;if(null!==f){var g=!0;null!==d&&(g=d.ba,d.ba=!0);f(this,
c,e);null!==d&&(d.ba=g)}null!==a&&(this.Bf!==a&&bp(a,this,e),tp(this),this.C(1));this.g("fromNode",b,a);Wo(this)}}},fromPortId:{configurable:!0,get:function(){return this.jf},set:function(a){var b=this.jf;if(b!==a){G&&A(a,"string",R,"fromPortId");var c=this.fromPort;null!==c&&$o(c);up(this);this.jf=a;var d=this.fromPort;null!==d&&$o(d);var e=this.diagram;if(null!==e){var f=this.data,g=e.model;null!==f&&g.aj()&&g.Vv(f,a)}c!==d&&(this.bg=null,this.$a(),f=this.fromPortChanged,null!==f&&
(g=!0,null!==e&&(g=e.ba,e.ba=!0),f(this,c,d),null!==e&&(e.ba=g)));tp(this);this.g("fromPortId",b,a)}}},fromPort:{configurable:!0,get:function(){var a=this.hf;return null===a?null:a.Es(this.jf)}},fromPortChanged:{configurable:!0,get:function(){return this.Pn},set:function(a){var b=this.Pn;b!==a&&(null!==a&&A(a,"function",R,"fromPortChanged"),this.Pn=a,this.g("fromPortChanged",b,a))}},toNode:{configurable:!0,get:function(){return this.Bf},set:function(a){var b=
this.Bf;if(b!==a){G&&null!==a&&w(a,V,R,"toNode");var c=this.toPort;null!==b&&(this.hf!==b&&cp(b,this,c),up(this),this.C(2));this.Bf=a;null!==a&&this.Tb(a.isVisible());this.bg=null;this.$a();var d=this.diagram;null!==d&&d.ba&&d.partManager.setToNodeForLink(this,a,b);var e=this.toPort,f=this.toPortChanged;if(null!==f){var g=!0;null!==d&&(g=d.ba,d.ba=!0);f(this,c,e);null!==d&&(d.ba=g)}null!==a&&(this.hf!==a&&bp(a,this,e),tp(this),this.C(1));this.g("toNode",b,a);Wo(this)}}},toPortId:{configurable:!0,
enumerable:!0,get:function(){return this.Cf},set:function(a){var b=this.Cf;if(b!==a){G&&A(a,"string",R,"toPortId");var c=this.toPort;null!==c&&$o(c);up(this);this.Cf=a;var d=this.toPort;null!==d&&$o(d);var e=this.diagram;if(null!==e){var f=this.data,g=e.model;null!==f&&g.aj()&&g.Zv(f,a)}c!==d&&(this.bg=null,this.$a(),f=this.toPortChanged,null!==f&&(g=!0,null!==e&&(g=e.ba,e.ba=!0),f(this,c,d),null!==e&&(e.ba=g)));tp(this);this.g("toPortId",b,a)}}},toPort:{configurable:!0,get:function(){var a=
this.Bf;return null===a?null:a.Es(this.Cf)}},toPortChanged:{configurable:!0,get:function(){return this.Pp},set:function(a){var b=this.Pp;b!==a&&(null!==a&&A(a,"function",R,"toPortChanged"),this.Pp=a,this.g("toPortChanged",b,a))}},fromSpot:{configurable:!0,get:function(){return null!==this.T?this.T.$g:dd},set:function(a){this.Rc();var b=this.T.$g;b.B(a)||(G&&w(a,Ib,R,"fromSpot"),a=a.L(),this.T.$g=a,this.g("fromSpot",b,a),(b.Uc()||a.Uc())&&null!==this.fromNode&&$o(this.fromPort),
this.$a())}},fromEndSegmentLength:{configurable:!0,get:function(){return null!==this.T?this.T.Yg:NaN},set:function(a){this.Rc();var b=this.T.Yg;b!==a&&(G&&A(a,"number",R,"fromEndSegmentLength"),0>a&&Ba(a,">= 0",R,"fromEndSegmentLength"),this.T.Yg=a,this.g("fromEndSegmentLength",b,a),this.$a())}},fromShortLength:{configurable:!0,get:function(){return null!==this.T?this.T.Zg:NaN},set:function(a){this.Rc();var b=this.T.Zg;b!==a&&(G&&A(a,"number",R,"fromShortLength"),this.T.Zg=
a,this.lc(!0),this.g("fromShortLength",b,a))}},toSpot:{configurable:!0,get:function(){return null!==this.T?this.T.Eh:dd},set:function(a){this.Rc();var b=this.T.Eh;b.B(a)||(G&&w(a,Ib,R,"toSpot"),a=a.L(),this.T.Eh=a,this.g("toSpot",b,a),(b.Uc()||a.Uc())&&null!==this.toNode&&$o(this.toPort),this.$a())}},toEndSegmentLength:{configurable:!0,get:function(){return null!==this.T?this.T.Ch:NaN},set:function(a){this.Rc();var b=this.T.Ch;b!==a&&(G&&A(a,"number",R,"toEndSegmentLength"),
0>a&&Ba(a,">= 0",R,"toEndSegmentLength"),this.T.Ch=a,this.g("toEndSegmentLength",b,a),this.$a())}},toShortLength:{configurable:!0,get:function(){return null!==this.T?this.T.Dh:NaN},set:function(a){this.Rc();var b=this.T.Dh;b!==a&&(G&&A(a,"number",R,"toShortLength"),this.T.Dh=a,this.lc(!0),this.g("toShortLength",b,a))}},isLabeledLink:{configurable:!0,get:function(){return null===this.ud?!1:0<this.ud.count}},labelNodes:{configurable:!0,get:function(){return null===
this.ud?hb:this.ud.iterator}},relinkableFrom:{configurable:!0,get:function(){return 0!==(this.Na&1)},set:function(a){var b=0!==(this.Na&1);b!==a&&(G&&A(a,"boolean",R,"relinkableFrom"),this.Na^=1,this.g("relinkableFrom",b,a),this.Rb())}},relinkableTo:{configurable:!0,get:function(){return 0!==(this.Na&2)},set:function(a){var b=0!==(this.Na&2);b!==a&&(G&&A(a,"boolean",R,"relinkableTo"),this.Na^=2,this.g("relinkableTo",b,a),this.Rb())}},resegmentable:{configurable:!0,
get:function(){return 0!==(this.Na&4)},set:function(a){var b=0!==(this.Na&4);b!==a&&(G&&A(a,"boolean",R,"resegmentable"),this.Na^=4,this.g("resegmentable",b,a),this.Rb())}},isTreeLink:{configurable:!0,get:function(){return 0!==(this.Na&8)},set:function(a){var b=0!==(this.Na&8);b!==a&&(G&&A(a,"boolean",R,"isTreeLink"),this.Na^=8,this.g("isTreeLink",b,a),null!==this.fromNode&&Kk(this.fromNode),null!==this.toNode&&Kk(this.toNode))}},path:{configurable:!0,get:function(){var a=
this.ub();return a instanceof Kf?a:null}},routeBounds:{configurable:!0,get:function(){this.Gg();var a=this.Jl,b=Infinity,c=Infinity,d=this.pointsCount;if(0===d)a.h(NaN,NaN,0,0);else{if(1===d)d=this.i(0),b=Math.min(d.x,b),c=Math.min(d.y,c),a.h(d.x,d.y,0,0);else if(2===d){d=this.i(0);var e=this.i(1);b=Math.min(d.x,e.x);c=Math.min(d.y,e.y);a.h(d.x,d.y,0,0);a.af(e)}else if(this.computeCurve()===gg&&3<=d&&!this.isOrthogonal)if(e=this.i(0),b=e.x,c=e.y,a.h(b,c,0,0),3===d){d=this.i(1);b=Math.min(d.x,
b);c=Math.min(d.y,c);var f=this.i(2);b=Math.min(f.x,b);c=Math.min(f.y,c);L.fm(e.x,e.y,d.x,d.y,d.x,d.y,f.x,f.y,.5,a)}else for(f=3;f<d;f+=3){var g=this.i(f-2);f+3>=d&&(f=d-1);var h=this.i(f-1),k=this.i(f);L.fm(e.x,e.y,g.x,g.y,h.x,h.y,k.x,k.y,.5,a);b=Math.min(k.x,b);c=Math.min(k.y,c);e=k}else for(e=this.i(0),f=this.i(1),b=Math.min(e.x,f.x),c=Math.min(e.y,f.y),a.h(e.x,e.y,0,0),a.af(f),e=2;e<d;e++)f=this.i(e),b=Math.min(f.x,b),c=Math.min(f.y,c),a.af(f);this.yu.h(b-a.x,c-a.y)}return a}},midPoint:{configurable:!0,
enumerable:!0,get:function(){this.Gg();return this.computeMidPoint(new K)}},midAngle:{configurable:!0,get:function(){this.Gg();return this.computeMidAngle()}},flattenedLengths:{configurable:!0,get:function(){if(null===this.qr){this.Ad||vp(this);for(var a=this.qr=[],b=this.pointsCount,c=0;c<b-1;c++){var d=this.i(c);var e=this.i(c+1);L.da(d.x,e.x)?(d=e.y-d.y,0>d&&(d=-d)):L.da(d.y,e.y)?(d=e.x-d.x,0>d&&(d=-d)):d=Math.sqrt(d.Jf(e));a.push(d)}}return this.qr}},flattenedTotalLength:{configurable:!0,
enumerable:!0,get:function(){var a=this.Tt;if(isNaN(a)){for(var b=this.flattenedLengths,c=b.length,d=a=0;d<c;d++)a+=b[d];this.Tt=a}return a}},points:{configurable:!0,get:function(){return this.Hb},set:function(a){var b=this.Hb;if(b!==a){var c=null;if(Array.isArray(a)){var d=0===a.length%2;if(d)for(var e=0;e<a.length;e++)if("number"!==typeof a[e]||isNaN(a[e])){d=!1;break}if(d)for(c=new H,d=0;d<a.length/2;d++)e=(new K(a[2*d],a[2*d+1])).freeze(),c.add(e);else{d=!0;for(e=0;e<a.length;e++){var f=
a[e];if(!Ga(f)||"number"!==typeof f.x||isNaN(f.x)||"number"!==typeof f.y||isNaN(f.y)){d=!1;break}}if(d)for(c=new H,d=0;d<a.length;d++)e=a[d],c.add((new K(e.x,e.y)).freeze());else G&&v("Link.points array must contain only an even number of numbers or objects with x and y properties, not: "+a)}}else if(a instanceof H)for(c=a.copy(),a=c.iterator;a.next();)a.value.freeze();else v("Link.points value is not an instance of List or Array: "+a);c.freeze();this.Hb=c;this.lc(!0);vp(this);a=this.diagram;null!==
a&&(a.$i||a.undoManager.isUndoingRedoing||a.Ts.add(this),a.animationManager.yb&&(a=a.animationManager,this.uf=c,a.Ll.add(this)));this.g("points",b,c)}}},pointsCount:{configurable:!0,get:function(){return this.Hb.count}},Ad:{configurable:!0,get:function(){return 0!==(this.Na&16)},set:function(a){0!==(this.Na&16)!==a&&(this.Na^=16)}},suspendsRouting:{configurable:!0,get:function(){return 0!==(this.Na&32)},set:function(a){0!==(this.Na&32)!==a&&(this.Na^=32)}},
computingPoints:{configurable:!0,get:function(){return 0!==(this.Na&64)},set:function(a){0!==(this.Na&64)!==a&&(this.Na^=64)}},defaultFromPoint:{configurable:!0,get:function(){return this.o},set:function(a){this.o=a.copy()}},defaultToPoint:{configurable:!0,get:function(){return this.F},set:function(a){this.F=a.copy()}},isOrthogonal:{configurable:!0,get:function(){return 2===(this.Oj.value&2)}},isAvoiding:{configurable:!0,get:function(){return 4===
(this.Oj.value&4)}},Pm:{configurable:!0,get:function(){return 0!==(this.Na&128)},set:function(a){0!==(this.Na&128)!==a&&(this.Na^=128)}},geometry:{configurable:!0,get:function(){this.Pm||(this.Gg(),this.sa=this.makeGeometry());return this.sa}},firstPickIndex:{configurable:!0,get:function(){return 2>=this.pointsCount?0:this.isOrthogonal||!zp(this.computeSpot(!0))?1:0}},lastPickIndex:{configurable:!0,get:function(){var a=this.pointsCount;return 0===
a?0:2>=a?a-1:this.isOrthogonal||!zp(this.computeSpot(!1))?a-2:a-1}},adjusting:{configurable:!0,get:function(){return this.Gk},set:function(a){var b=this.Gk;b!==a&&(G&&a!==dg&&a!==op&&a!==pp&&a!==qp&&v("Link.adjusting can only be set to Link.None, Link.End, LInk.Scale, or Link.Stretch, not: "+a),this.Gk=a,this.g("adjusting",b,a))}},corner:{configurable:!0,get:function(){return this.tn},set:function(a){var b=this.tn;b!==a&&(G&&A(a,"number",R,"corner"),this.tn=a,this.lc(!0),
this.g("corner",b,a))}},curve:{configurable:!0,get:function(){return this.vn},set:function(a){var b=this.vn;b!==a&&(G&&a!==dg&&a!==gg&&a!==cg&&a!==bg&&v("Link.curve can only be set to Link.None, Link.Bezier, LInk.JumpGap, or Link.JumpOver, not: "+a),this.vn=a,this.$a(),this.lc(!0),wp(this,b===cg||b===bg||a===cg||a===bg),this.g("curve",b,a))}},curviness:{configurable:!0,get:function(){return this.wn},set:function(a){var b=this.wn;b!==a&&(G&&A(a,"number",R,"curviness"),this.wn=
a,this.$a(),this.lc(!1),this.g("curviness",b,a))}},routing:{configurable:!0,get:function(){return this.Oj},set:function(a){var b=this.Oj;b!==a&&(G&&a!==np&&a!==Wp&&a!==Xp&&a!==Fp&&v("Link.routing can only be set to Link.Normal, Link.Orthogonal, LInk.AvoidsNodes, not: "+a),this.Oj=a,this.bg=null,this.$a(),wp(this,2===(b.value&2)||2===(a.value&2)),this.g("routing",b,a))}},smoothness:{configurable:!0,get:function(){return this.Ep},set:function(a){var b=this.Ep;b!==a&&(G&&
A(a,"number",R,"smoothness"),this.Ep=a,this.lc(!0),this.g("smoothness",b,a))}},key:{configurable:!0,get:function(){var a=this.diagram;if(null!==a&&a.model.aj())return a.model.vc(this.data)}}});R.prototype.invalidateOtherJumpOvers=R.prototype.rq;R.prototype.findClosestSegment=R.prototype.Wz;R.prototype.updateRoute=R.prototype.Gg;R.prototype.invalidateRoute=R.prototype.$a;R.prototype.rollbackRoute=R.prototype.Qv;R.prototype.commitRoute=R.prototype.Hf;R.prototype.startRoute=R.prototype.Wh;
R.prototype.clearPoints=R.prototype.ak;R.prototype.removePoint=R.prototype.Ov;R.prototype.addPointAt=R.prototype.Ff;R.prototype.addPoint=R.prototype.me;R.prototype.insertPointAt=R.prototype.l;R.prototype.insertPoint=R.prototype.BA;R.prototype.setPointAt=R.prototype.P;R.prototype.setPoint=R.prototype.Wc;R.prototype.getPoint=R.prototype.i;R.prototype.getOtherPort=R.prototype.sA;R.prototype.getOtherNode=R.prototype.nq;
var xp=null,yp=null,np=new F(R,"Normal",1),Wp=new F(R,"Orthogonal",2),Xp=new F(R,"AvoidsNodes",6),Fp=new F(R,"AvoidsNodesStraight",7),dg=new F(R,"None",0),gg=new F(R,"Bezier",9),cg=new F(R,"JumpGap",10),bg=new F(R,"JumpOver",11),op=new F(R,"End",17),pp=new F(R,"Scale",18),qp=new F(R,"Stretch",19),an=new F(R,"OrientAlong",21),Um=new F(R,"OrientPlus90",22),Wm=new F(R,"OrientMinus90",23),rp=new F(R,"OrientOpposite",24),bn=new F(R,"OrientUpright",25),Vm=new F(R,"OrientPlus90Upright",26),Xm=new F(R,"OrientMinus90Upright",
27),Ym=new F(R,"OrientUpright45",28),Hp=16,Gp=14,Ip=8;R.className="Link";R.Normal=np;R.Orthogonal=Wp;R.AvoidsNodes=Xp;R.AvoidsNodesStraight=Fp;R.None=dg;R.Bezier=gg;R.JumpGap=cg;R.JumpOver=bg;R.End=op;R.Scale=pp;R.Stretch=qp;R.OrientAlong=an;R.OrientPlus90=Um;R.OrientMinus90=Wm;R.OrientOpposite=rp;R.OrientUpright=bn;R.OrientPlus90Upright=Vm;R.OrientMinus90Upright=Xm;R.OrientUpright45=Ym;R.EndSegmentStep=8;R.CurvinessStart=Hp;R.SpacingMin=Gp;R.OrthoShortCut=Ip;R.AvoidanceCell=8;R.AvoidanceLimit=999;
function Vp(a,b,c,d){ab(this);this.Ee=this.wr=!1;this.Ws=a;this.Dy=b;this.Bv=c;this.Ey=d;this.links=[]}Vp.prototype.qm=function(){if(!this.wr){var a=this.links;0<a.length&&(a=a[0].diagram,null!==a&&(a.bx.add(this),this.Ee=a.undoManager.isUndoingRedoing))}this.wr=!0};
Vp.prototype.kw=function(){if(this.wr){this.wr=!1;var a=this.links;if(0<a.length){var b=a[0],c=b.diagram;c=null===c||c.$i&&!this.Ee;this.Ee=!1;b.arrangeBundledLinks(a,c);1===a.length&&(b.Yf=null,a.length=0)}0===a.length&&(a=this.Ws,null!==this&&null!==a.ef&&a.ef.remove(this),a=this.Bv,null!==this&&null!==a.ef&&a.ef.remove(this))}};Vp.className="LinkBundle";
function nk(){ab(this);this.Oy=this.group=null;this.Ms=!0;this.abort=!1;this.Gd=this.Fd=1;this.Co=this.Bo=-1;this.nc=this.mc=8;this.Yb=null;this.Ki=this.Ji=0;this.Py=11;this.wy=124}
nk.prototype.initialize=function(a){if(!(0>=a.width||0>=a.height)){var b=a.y,c=a.x+a.width,d=a.y+a.height;this.Fd=Math.floor((a.x-this.mc)/this.mc)*this.mc;this.Gd=Math.floor((b-this.nc)/this.nc)*this.nc;this.Bo=Math.ceil((c+2*this.mc)/this.mc)*this.mc;this.Co=Math.ceil((d+2*this.nc)/this.nc)*this.nc;a=1+(Math.ceil((this.Bo-this.Fd)/this.mc)|0);b=1+(Math.ceil((this.Co-this.Gd)/this.nc)|0);if(null===this.Yb||this.Ji<a-1||this.Ki<b-1){c=[];for(d=0;d<=a;d++)c[d]=new Uint32Array(b);this.Yb=c;this.Ji=
a-1;this.Ki=b-1}a=Yp;if(null!==this.Yb)for(b=0;b<=this.Ji;b++)if(c=this.Yb[b],c.fill)c.fill(a);else for(d=0;d<=this.Ki;d++)c[d]=a}};function Bk(a,b,c){return a.Fd<=b&&b<=a.Bo&&a.Gd<=c&&c<=a.Co}function Kp(a,b,c){if(!Bk(a,b,c))return Yp;b-=a.Fd;b/=a.mc;c-=a.Gd;c/=a.nc;return a.Yb[b|0][c|0]}function Ak(a){if(null!==a.Yb)for(var b=0;b<=a.Ji;b++)for(var c=a.Yb[b],d=0;d<=a.Ki;d++)c[d]>=Np&&(c[d]=Yp)}
nk.prototype.pk=function(a,b,c,d){if(a>this.Bo||a+c<this.Fd||b>this.Co||b+d<this.Gd)return!0;a=(a-this.Fd)/this.mc|0;b=(b-this.Gd)/this.nc|0;c=Math.max(0,c)/this.mc+1|0;var e=Math.max(0,d)/this.nc+1|0;0>a&&(c+=a,a=0);0>b&&(e+=b,b=0);if(0>c||0>e)return!0;d=Math.min(a+c-1,this.Ji)|0;for(c=Math.min(b+e-1,this.Ki)|0;a<=d;a++){e=this.Yb[a];for(var f=b;f<=c;f++)if(e[f]===Ck)return!1}return!0};
function Zp(a,b,c,d,e,f,g,h,k){if(!(b<f||b>g||c<h||c>k)){var l=b|0;var m=c|0;var n=a.Yb[l][m];if(n>=Np&&n<Lp)for(e?m+=d:l+=d,n+=1;f<=l&&l<=g&&h<=m&&m<=k&&!(n>=a.Yb[l][m]);)a.Yb[l][m]=n,n+=1,e?m+=d:l+=d;l=e?m:l;if(e)if(0<d)for(c+=d;c<l;c+=d)Zp(a,b,c,1,!e,f,g,h,k),Zp(a,b,c,-1,!e,f,g,h,k);else for(c+=d;c>l;c+=d)Zp(a,b,c,1,!e,f,g,h,k),Zp(a,b,c,-1,!e,f,g,h,k);else if(0<d)for(b+=d;b<l;b+=d)Zp(a,b,c,1,!e,f,g,h,k),Zp(a,b,c,-1,!e,f,g,h,k);else for(b+=d;b>l;b+=d)Zp(a,b,c,1,!e,f,g,h,k),Zp(a,b,c,-1,!e,f,g,h,
k)}}function $p(a,b,c,d,e,f,g,h,k){b|=0;c|=0;var l=Ck,m=Np;for(a.Yb[b][c]=m;l===Ck&&b>f&&b<g&&c>h&&c<k;)m+=1,a.Yb[b][c]=m,e?c+=d:b+=d,l=a.Yb[b][c]}function aq(a,b,c,d,e,f,g,h,k){b|=0;c|=0;var l=Ck,m=Lp;for(a.Yb[b][c]=m;l===Ck&&b>f&&b<g&&c>h&&c<k;)a.Yb[b][c]=m,e?c+=d:b+=d,l=a.Yb[b][c]}
function Jp(a,b,c,d,e,f,g){if(null!==a.Yb){a.abort=!1;var h=b.x,k=b.y;if(Bk(a,h,k)){h-=a.Fd;h/=a.mc;k-=a.Gd;k/=a.nc;var l=d.x,m=d.y;if(Bk(a,l,m))if(l-=a.Fd,l/=a.mc,m-=a.Gd,m/=a.nc,1>=Math.abs(h-l)&&1>=Math.abs(k-m))a.abort=!0;else{var n=f.x;d=f.y;b=f.x+f.width;var p=f.y+f.height;n-=a.Fd;n/=a.mc;d-=a.Gd;d/=a.nc;b-=a.Fd;b/=a.mc;p-=a.Gd;p/=a.nc;f=Math.max(0,Math.min(a.Ji,n|0));b=Math.min(a.Ji,Math.max(0,b|0));n=Math.max(0,Math.min(a.Ki,d|0));p=Math.min(a.Ki,Math.max(0,p|0));d=a.Yb;h|=0;k|=0;l|=0;m|=
0;var r=0===c||90===c?1:-1;c=90===c||270===c;d[h][k]===Ck?($p(a,h,k,r,c,f,b,n,p),$p(a,h,k,1,!c,f,b,n,p),$p(a,h,k,-1,!c,f,b,n,p)):$p(a,h,k,r,c,h,k,h,k);d[l][m]===Ck?(aq(a,l,m,0===e||90===e?1:-1,90===e||270===e,f,b,n,p),aq(a,l,m,1,!(90===e||270===e),f,b,n,p),aq(a,l,m,-1,!(90===e||270===e),f,b,n,p)):aq(a,l,m,r,c,l,m,l,m);c=Na();if(g&&bq(a,l,m,e,h,k,c)){if(c[0]!==l||c[1]!==m)c.unshift(m),c.unshift(l);if(c[c.length-2]!==h||c[c.length-1]!==k)c.push(h),c.push(k);a=Np;e=c[c.length-2];g=c[c.length-1];d[e][g]=
a++;for(f=c.length-4;0<=f;f-=2)for(e=c[f+2],g=c[f+3],b=c[f],l=c[f+1];b>e?e++:b<e?e--:l>g?g++:l<g&&g--,d[e][g]=a++,e!==b||g!==l;);}else Zp(a,h,k,1,!1,f,b,n,p),Zp(a,h,k,-1,!1,f,b,n,p),Zp(a,h,k,1,!0,f,b,n,p),Zp(a,h,k,-1,!0,f,b,n,p);Pa(c)}}}}
function bq(a,b,c,d,e,f,g){for(var h=a.Yb,k=b,l=c;;){if(k===e&&l===f)return!0;var m=k,n=l;if(0===d)if(m<e)m++;else break;else if(90===d)if(n<f)n++;else break;else if(180===d)if(m>e)m--;else break;else if(n>f)n--;else break;var p=h[m][n];if(0===p||p===cq)break;k=m;l=n}for(;;){m=d;n=k;p=l;0===d?p<f?(m=90,p++):p>f&&(m=270,p--):90===d?n<e?(m=0,n++):n>e&&(m=180,n--):180===d?p<f?(m=90,p++):p>f&&(m=270,p--):n<e?(m=0,n++):n>e&&(m=180,n--);n=h[n][p];if(m!==d&&0!==n&&n!==cq){g.push(k);g.push(l);if(bq(a,k,l,
m,e,f,g))return!0;g.pop();g.pop()}h[k][l]=cq;if(0===d){if(k===b)return!1;k--}else if(90===d){if(l===c)return!1;l--}else if(180===d){if(k===b)return!1;k++}else{if(l===c)return!1;l++}}}
na.Object.defineProperties(nk.prototype,{bounds:{configurable:!0,get:function(){return new M(this.Fd,this.Gd,this.Bo-this.Fd,this.Co-this.Gd)}},cq:{configurable:!0,get:function(){return this.mc},set:function(a){0<a&&a!==this.mc&&(this.mc=a,this.initialize(this.bounds))}},bq:{configurable:!0,get:function(){return this.nc},set:function(a){0<a&&a!==this.nc&&(this.nc=a,this.initialize(this.bounds))}}});var Ck=0,Np=1,Lp=999999,Yp=Lp+1,cq=Lp+2;nk.className="PositionArray";
function Dp(){ab(this);this.port=this.node=null;this.oe=[];this.vq=!1}Dp.prototype.toString=function(){for(var a=this.oe,b=this.node.toString()+" "+a.length.toString()+":",c=0;c<a.length;c++){var d=a[c];null!==d&&(b+="\n  "+d.toString())}return b};
function dq(a,b,c,d){b=b.offsetY;switch(b){case 8:return 90;case 2:return 180;case 1:return 270;case 4:return 0}switch(b){case 9:return 180<c?270:90;case 6:return 90<c&&270>=c?180:0}a=180*Math.atan2(a.height,a.width)/Math.PI;switch(b){case 3:return c>a&&c<=180+a?180:270;case 5:return c>180-a&&c<=360-a?270:0;case 12:return c>a&&c<=180+a?90:0;case 10:return c>180-a&&c<=360-a?180:90;case 7:return 90<c&&c<=180+a?180:c>180+a&&c<=360-a?270:0;case 13:return 180<c&&c<=360-a?270:c>a&&180>=c?90:0;case 14:return c>
a&&c<=180-a?90:c>180-a&&270>=c?180:0;case 11:return c>180-a&&c<=180+a?180:c>180+a?270:90}d&&15!==b&&(c-=15,0>c&&(c+=360));return c>a&&c<180-a?90:c>=180-a&&c<=180+a?180:c>180+a&&c<360-a?270:0}Dp.prototype.qm=function(){this.oe.length=0};
function Ep(a,b){var c=a.oe;if(0===c.length){a:if(!a.vq){c=a.vq;a.vq=!0;var d=null,e=a.node,f=e instanceof yf?e:null;if(null===f||f.isSubGraphExpanded)var g=e.isTreeExpanded?e.findLinksConnected(a.port.portId):e.ay();else{if(!f.actualBounds.s()){a.vq=c;break a}d=f;g=d.av()}f=a.oe.length=0;var h=a.port.ja(Cc,K.alloc()),k=a.port.ja(Nc,K.alloc());e=M.allocAt(h.x,h.y,0,0);e.af(k);K.free(h);K.free(k);h=K.allocAt(e.x+e.width/2,e.y+e.height/2);k=a.port.Vi();for(g=g.iterator;g.next();){var l=g.value;if(l.isVisible()&&
l.fromPort!==l.toPort){var m=l.fromPort===a.port||null!==l.fromNode&&l.fromNode.Pd(d),n=l.computeSpot(m,a.port);if(n.Uc()){var p=m?l.toPort:l.fromPort;if(null!==p&&(m=p.part,null!==m)){var r=m.findVisibleNode();null!==r&&r!==m&&(m=r,p=m.port);m=l.computeOtherPoint(m,p);p=h.Va(p.ja(Ic));r=h.Va(m);p+=(r-p)/360;p-=k;0>p?p+=360:360<=p&&(p-=360);n=dq(e,n,p,l.isOrthogonal);0===n?(n=4,180<p&&(p-=360)):90===n?(n=8,270<p&&(p-=360)):180===n?n=2:(n=1,90>p&&(p+=360));r=a.oe[f];void 0===r?(r=new eq(l,p,n),a.oe[f]=
r):(r.link=l,r.angle=p,r.Hc=n);r.Ev.set(m);f++}}}}K.free(h);a.oe.sort(Dp.prototype.j);k=a.oe.length;d=-1;for(f=h=0;f<k;f++)g=a.oe[f],void 0!==g&&(g.Hc!==d&&(d=g.Hc,h=0),g.oq=h,h++);d=-1;h=0;for(f=k-1;0<=f;f--)k=a.oe[f],void 0!==k&&(k.Hc!==d&&(d=k.Hc,h=k.oq+1),k.jm=h);f=a.oe;n=a.port;d=a.node.portSpreading;h=K.alloc();k=K.alloc();g=K.alloc();l=K.alloc();n.ja(Cc,h);n.ja(Gc,k);n.ja(Nc,g);n.ja(Kc,l);r=p=m=n=0;if(d===kp)for(var q=0;q<f.length;q++){var u=f[q];if(null!==u){var x=u.link.computeThickness();
switch(u.Hc){case 8:p+=x;break;case 2:r+=x;break;case 1:n+=x;break;default:case 4:m+=x}}}var y=q=0,z=1,B=u=0;for(x=0;x<f.length;x++){var D=f[x];if(null!==D){if(q!==D.Hc){q=D.Hc;switch(q){case 8:var C=g;y=l;break;case 2:C=l;y=h;break;case 1:C=h;y=k;break;default:case 4:C=k,y=g}u=y.x-C.x;B=y.y-C.y;switch(q){case 8:p>Math.abs(u)?(z=Math.abs(u)/p,p=Math.abs(u)):z=1;break;case 2:r>Math.abs(B)?(z=Math.abs(B)/r,r=Math.abs(B)):z=1;break;case 1:n>Math.abs(u)?(z=Math.abs(u)/n,n=Math.abs(u)):z=1;break;default:case 4:m>
Math.abs(B)?(z=Math.abs(B)/m,m=Math.abs(B)):z=1}y=0}var J=D.uq;if(d===kp){D=D.link.computeThickness();D*=z;J.set(C);switch(q){case 8:J.x=C.x+u/2+p/2-y-D/2;break;case 2:J.y=C.y+B/2+r/2-y-D/2;break;case 1:J.x=C.x+u/2-n/2+y+D/2;break;default:case 4:J.y=C.y+B/2-m/2+y+D/2}y+=D}else{var S=.5;d===Xo&&(S=(D.oq+1)/(D.jm+1));J.x=C.x+u*S;J.y=C.y+B*S}}}K.free(h);K.free(k);K.free(g);K.free(l);C=a.oe;for(f=0;f<C.length;f++)d=C[f],null!==d&&(d.Yu=a.computeEndSegmentLength(d));a.vq=c;M.free(e)}c=a.oe}for(a=0;a<c.length;a++)if(e=
c[a],null!==e&&e.link===b)return e;return null}Dp.prototype.j=function(a,b){return a===b?0:null===a?-1:null===b?1:a.Hc<b.Hc?-1:a.Hc>b.Hc?1:a.angle<b.angle?-1:a.angle>b.angle?1:0};
Dp.prototype.computeEndSegmentLength=function(a){var b=a.link,c=b.computeEndSegmentLength(this.node,this.port,Bc,b.fromPort===this.port),d=a.oq;if(0>d)return c;var e=a.jm;if(1>=e||!b.isOrthogonal)return c;b=a.Ev;var f=a.uq;if(2===a.Hc||8===a.Hc)d=e-1-d;return((a=2===a.Hc||4===a.Hc)?b.y<f.y:b.x<f.x)?c+8*d:(a?b.y===f.y:b.x===f.x)?c:c+8*(e-1-d)};Dp.className="Knot";function eq(a,b,c){this.link=a;this.angle=b;this.Hc=c;this.Ev=new K;this.jm=this.oq=0;this.uq=new K;this.Yu=0}
eq.prototype.toString=function(){return this.link.toString()+" "+this.angle.toString()+" "+this.Hc.toString()+":"+this.oq.toString()+"/"+this.jm.toString()+" "+this.uq.toString()+" "+this.Yu.toString()+" "+this.Ev.toString()};eq.className="LinkInfo";function ll(){this.Eh=this.$g=dd;this.Dh=this.Zg=this.Ch=this.Yg=NaN;this.Np=this.Nn=null;this.Op=this.On=Infinity}
ll.prototype.copy=function(){var a=new ll;a.$g=this.$g.L();a.Eh=this.Eh.L();a.Yg=this.Yg;a.Ch=this.Ch;a.Zg=this.Zg;a.Dh=this.Dh;a.Nn=this.Nn;a.Np=this.Np;a.On=this.On;a.Op=this.Op;return a};ll.className="LinkSettings";function zi(a){ab(this);this.o=this.D=null;this.ki=this.io=!0;this.oo=!1;this.cn=(new K(0,0)).freeze();this.lo=!0;this.gn=this.ko=null;this.no=!1;this.j=null;this.F=0;this.Do=this.Up=null;this.us=!1;this.wg=this.Qj=null;this.ls=!1;a&&Object.assign(this,a)}
zi.prototype.cloneProtected=function(a){a.io=this.io;a.ki=this.ki;a.oo=this.oo;a.cn.assign(this.cn);a.lo=this.lo;a.ko=this.ko;a.gn=this.gn;a.no=!0;a.Do=this.Do;a.Up=this.Up};zi.prototype.copy=function(){var a=new this.constructor;this.cloneProtected(a);return a};zi.prototype.serializeLayoutProperties=function(a){a.arrangementOrigin={x:this.arrangementOrigin.x,y:this.arrangementOrigin.y};a.isRouting=this.isRouting};
zi.prototype.deserializeLayoutProperties=function(a){null!==a&&(this.arrangementOrigin=new K(a.arrangementOrigin.x,a.arrangementOrigin.y),this.isRouting=a.isRouting)};zi.prototype.mb=function(a){Ea(this,a)};zi.prototype.toString=function(){var a=Qa(this.constructor);a+="(";null!==this.group&&(a+=" in "+this.group);null!==this.diagram&&(a+=" for "+this.diagram);return a+")"};
zi.prototype.C=function(){if(this.isValidLayout){var a=this.diagram;if(null!==a&&!a.undoManager.isUndoingRedoing){var b=a.animationManager;!b.isTicking&&(b.defaultAnimation.isAnimating&&b.wc(),this.isOngoing&&a.$i||this.isInitial&&!a.$i)&&(this.isValidLayout=!1,a.Lb())}}};zi.prototype.createNetwork=function(){return new fq(this)};zi.prototype.makeNetwork=function(a){var b=this.createNetwork();a instanceof Q?(b.yg(a.nodes,!0),b.yg(a.links,!0)):a instanceof yf?b.yg(a.memberParts):b.yg(a.iterator);return b};
zi.prototype.updateParts=function(){this.isValidLayout=!0;if(!this.workerLayout()){var a=this.diagram;if(null===a&&null!==this.network)for(var b=this.network.vertexes.iterator;b.next();){var c=b.value.node;if(null!==c&&(a=c.diagram,null!==a))break}try{null!==a&&a.Ea("Layout"),this.commitLayout()}finally{null!==a&&a.cb("Layout")}}};zi.prototype.commitLayout=function(){if(null!==this.network){for(var a=this.network.vertexes.iterator;a.next();)a.value.commit();if(this.isRouting)for(a=this.network.edges.iterator;a.next();)a.value.commit()}};
zi.prototype.doLayout=function(a){G&&null===a&&v("Layout.doLayout(collection) argument must not be null but a Diagram, a Group, or an Iterable of Parts");var b=new I;a instanceof Q?(gq(this,b,a.nodes,!0,this.Uh,!0,!1,!0),gq(this,b,a.parts,!0,this.Uh,!0,!1,!0)):a instanceof yf?gq(this,b,a.memberParts,!1,this.Uh,!0,!1,!0):b.addAll(a.iterator);0<b.count&&(a=this.diagram,null!==a&&a.Ea("Layout"),this.doMinimalNoNetworkLayout(b),null!==a&&a.cb("Layout"));this.isValidLayout=!0};
zi.prototype.doMinimalNoNetworkLayout=function(a){var b=Math.ceil(Math.sqrt(a.count));this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);var c=this.arrangementOrigin.x,d=c,e=this.arrangementOrigin.y,f=0,g=0;for(a=a.iterator;a.next();){var h=a.value;hq(h);var k=h.measuredBounds,l=k.width;k=k.height;h.moveTo(d,e);h instanceof yf&&(h.Uh=!1);d+=Math.max(l,50)+20;g=Math.max(g,Math.max(k,50));f>=b-1?(f=0,d=c,e+=g+20,g=0):f++}};
zi.prototype.doMinimalNetworkLayout=function(){var a=Math.ceil(Math.sqrt(this.network.vertexes.count));this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);for(var b=this.arrangementOrigin.x,c=b,d=this.arrangementOrigin.y,e=0,f=0,g=this.network.vertexes.iterator;g.next();){var h=g.value.node;if(!(null===h||h instanceof R)&&(hq(h),this.Uh(h))){var k=h.measuredBounds,l=k.width;k=k.height;h.moveTo(c,d);h instanceof yf&&(h.Uh=!1);c+=Math.max(l,50)+20;f=Math.max(f,Math.max(k,50));e>=a-1?(e=
0,c=b,d+=f+20,f=0):e++}}};zi.prototype.Uh=function(a){return!a.location.s()||a instanceof yf&&a.Uh?!0:!1};function gq(a,b,c,d,e,f,g,h){for(c=c.iterator;c.next();){var k=c.value;d&&!k.isTopLevel||null!==e&&!e(k)||!k.canLayout()||(f&&k instanceof V?k.isLinkLabel||(k instanceof yf?null===k.layout?gq(a,b,k.memberParts,!1,e,f,g,h):(hq(k),b.add(k)):(hq(k),b.add(k))):g&&k instanceof R?b.add(k):!h||!k.Tc()||k instanceof V||(hq(k),b.add(k)))}}
function hq(a){var b=a.actualBounds;(0===b.width||0===b.height||isNaN(b.width)||isNaN(b.height))&&a.Ya()}zi.prototype.Xi=function(a,b){var c=this.boundsComputation;if(null!==c)return b||(b=new M),c(a,this,b);if(!b)return a.actualBounds;b.set(a.actualBounds);return b};
zi.prototype.Px=function(a){var b=new I;a instanceof Q?(gq(this,b,a.nodes,!0,null,!0,!0,!0),gq(this,b,a.links,!0,null,!0,!0,!0),gq(this,b,a.parts,!0,null,!0,!0,!0)):a instanceof yf?gq(this,b,a.memberParts,!1,null,!0,!0,!0):gq(this,b,a.iterator,!1,null,!0,!0,!0);return b};
zi.prototype.initialOrigin=function(a){var b=this.group;if(null!==b){var c=b.position.copy();(isNaN(c.x)||isNaN(c.y))&&c.set(a);b=b.placeholder;null!==b&&(c=b.ja(Cc),(isNaN(c.x)||isNaN(c.y))&&c.set(a),a=b.padding,c.x+=a.left,c.y+=a.top);return c}return a};zi.prototype.mayUseWorker=function(){return this.mayUseWorkerFunction?this.mayUseWorkerFunction(this):!1};zi.prototype.workerLayout=function(){return!1};
function iq(a,b){if(null!==a.workerStateChanged){var c={key:a.group?a.group.key:null};void 0!==b&&(c.time=b);null!==a.Qj&&(c.running=jq(a.Qj));null!==a.wg&&(c.waiting=jq(a.wg));a.workerStateChanged(c,a)}}function jq(a){return{vertexes:a.vertexes.count,edges:a.edges.count}}zi.prototype.Bz=function(){var a=kq(this.constructor);a&&(null!==a.bf&&a.bf.terminate(),a.bf=null,a.sm.iteratorValues.each(function(a){a.us=!1;a.Qj=null;a.wg=null;a.ls=!1;iq(a)}),a.sm.clear())};
function lq(a,b){var c=kq(a);if(c){if(b)for(var d in b)c[d]=b[d]}else throw Error("Unknown Layout class: "+a);}function kq(a){var b=null;if("function"===typeof a){if(b=mq.get(a),!b){var c=Qa(a);b=mq.get(c);b||(b=new nq,b.Ru=a,b.name=c,b.j=a.name,b.py=oq,mq.set(c,b),mq.set(a,b),mq.set(a.name,b))}}else"string"===typeof a&&(b=mq.get(a));return b}
zi.prototype.jw=function(){if("undefined"===typeof Worker||!pq||"undefined"===typeof self||"undefined"!==typeof self.DedicatedWorkerGlobalScope)return!1;if(!this.mayUseWorker())return this.us&&(this.ls=!0,this.wg=this.Qj=null,iq(this)),!1;var a=kq(this.constructor);if(null===a)return!1;null===a.bf&&(a.bf=new Worker(pq),a.bf.onerror=function(a){a.preventDefault();Fa("Worker Error at: "+a.filename+" "+a.lineno+" "+a.colno+"\n  "+a.message)},a.bf.j=function(a){Fa("Worker serialization error: "+a)},a.bf.onmessage=
function(b){var c=b.data;if("_GoJS"===c._GoJS)if(c.version&&Q.version&&c.version!==Q.version)Fa("Failure: GoJS v"+Q.version+"  Worker v"+c.version);else if(b=a.sm.get(c.id)){a.sm.remove(c.id);b.us=!1;b.Qj=null;if(b.ls)b.ls=!1,b.wg=null;else{var d=qq(b,c,!1);b.network=d;b.updateParts();b.network=null;b.isValidLayout=!0}iq(b,c.time);c=b.wg;if(null!==c)b.wg=null;else for(d=a.sm.iteratorValues;d.next();){var e=d.value;c=e.wg;if(null!==c){e.wg=null;break}}null!==c&&rq(b,c)}},a.bf.postMessage({_GoJS:"_GoJS",
url:a.py}),Array.isArray(a.scripts)&&a.scripts.forEach(function(b){a.bf.postMessage({_GoJS:"_GoJS",url:b})}),a.bf.postMessage({_GoJS:"_GoJS",version:-1}));null!==this.Qj?this.wg=this.network:rq(this,this.network);iq(this);this.doMinimalNetworkLayout();this.network=null;return this.isValidLayout=!0};function rq(a,b){a.us=!0;var c=kq(a.constructor),d=sq(a,b,!0);d._GoJS="_GoJS";c.bf.postMessage(d);c.sm.set(lb(a),a);a.Qj=b}
function sq(a,b,c){a.onNetworkSerialization(1,c,b,null);var d={};a.serializeLayoutProperties(d,c);var e=[];b.vertexes.each(function(a){var b={};a.serializeVertexProperties(b,c);e.push(b)});var f=[];b.edges.each(function(a){var b={};a.serializeEdgeProperties(b,c);f.push(b)});d={id:c?lb(a):a.id,layout:Qa(a.constructor),p:d,pB:e,Uz:f};a.onNetworkSerialization(2,c,b,d);return d}
function qq(a,b,c){c&&(a.id=b.id);var d=a.diagram,e=a.createNetwork();a.onNetworkSerialization(3,c,e,b);var f=b.pB,g=new yb;f&&f.forEach(function(a){var b=null;null===a.key||null===d||c||(b=d.Jb(a.key));null!==b?b=e.Zj(b):(b=e.createVertex(),e.zg(b));c&&null!==a.key&&(b.data={oi:a.key});g.set(a.id,b)});var h=b.Uz,k=new yb;h&&h.forEach(function(a){var b=null;null===a.key||null===d||c||(b=d.findLinkForKey(a.key));var f=e.createEdge();e.dm(f);f.link=b;c&&null!==a.key&&(f.data={oi:a.key});k.set(a.id,
f)});f&&f.forEach(function(a){var b=g.get(a.id);b&&b.deserializeVertexProperties(a,g,k,c)});h&&h.forEach(function(a){var b=k.get(a.id);b&&b.deserializeEdgeProperties(a,g,k,c)});a.deserializeLayoutProperties(b.p,g,k,c,e);a.onNetworkSerialization(4,c,e,b);return e}zi.prototype.onNetworkSerialization=function(){};
na.Object.defineProperties(zi.prototype,{diagram:{configurable:!0,get:function(){return this.D},set:function(a){null!==a&&w(a,Q,zi,"diagram");this.D=a}},group:{configurable:!0,get:function(){return this.o},set:function(a){this.o!==a&&(null!==a&&w(a,yf,zi,"group"),this.o=a,null!==a&&(this.D=a.diagram))}},isOngoing:{configurable:!0,get:function(){return this.io},set:function(a){this.io!==a&&(A(a,"boolean",zi,"isOngoing"),this.io=a)}},isInitial:{configurable:!0,
enumerable:!0,get:function(){return this.ki},set:function(a){A(a,"boolean",zi,"isInitial");this.ki=a;a||(this.no=!0)}},isViewportSized:{configurable:!0,get:function(){return this.oo},set:function(a){this.oo!==a&&(A(a,"boolean",zi,"isViewportSized"),(this.oo=a)&&this.C())}},isRouting:{configurable:!0,get:function(){return this.lo},set:function(a){this.lo!==a&&(A(a,"boolean",zi,"isRouting"),this.lo=a)}},isRealtime:{configurable:!0,get:function(){return this.ko},
set:function(a){this.ko!==a&&(null!==a&&A(a,"boolean",zi,"isRealtime"),this.ko=a)}},isValidLayout:{configurable:!0,get:function(){return this.no},set:function(a){this.no!==a&&(A(a,"boolean",zi,"isValidLayout"),this.no=a,a||(a=this.diagram,null!==a&&(a.Zh=!0)))}},network:{configurable:!0,get:function(){return this.j},set:function(a){this.j!==a&&(null!==a&&w(a,fq,zi,"network"),this.j=a,null!==a&&(a.layout=this))}},boundsComputation:{configurable:!0,get:function(){return this.gn},
set:function(a){this.gn!==a&&(null!==a&&A(a,"function",zi,"boundsComputation"),this.gn=a,this.C())}},arrangementOrigin:{configurable:!0,get:function(){return this.cn},set:function(a){w(a,K,zi,"arrangementOrigin");this.cn.B(a)||(this.cn.assign(a),this.C())}},id:{configurable:!0,get:function(){return this.F},set:function(a){this.F=a}},mayUseWorkerFunction:{configurable:!0,get:function(){return this.Do},set:function(a){this.Do!==a&&(null!==a&&A(a,"function",
zi,"mayUseWorkerFunction"),this.Do=a)}},workerStateChanged:{configurable:!0,get:function(){return this.Up},set:function(a){this.Up!==a&&(null!==a&&A(a,"function",zi,"workerStateChanged"),this.Up=a)}}});zi.prototype.useWorker=zi.prototype.jw;zi.declareWorkerLayout=lq;zi.prototype.cancelWorker=zi.prototype.Bz;zi.prototype.collectParts=zi.prototype.Px;zi.prototype.getLayoutBounds=zi.prototype.Xi;zi.prototype.invalidateLayout=zi.prototype.C;
var mq=new yb,oq="object"===typeof sa.document&&sa.document.currentScript?sa.document.currentScript.src:"",pq="undefined"!==typeof URL&&"function"===typeof URL.createObjectURL&&"function"===typeof Blob?URL.createObjectURL(new Blob(["self.onmessage=function(e){if(e.data.url){\nimportScripts(e.data.url);}}"],{type:"text/javascript"})):"";zi.className="Layout";zi.GoJSScriptURL=oq;zi.declareWorkerLayout=lq;
"undefined"!==typeof self&&"undefined"!==typeof self.DedicatedWorkerGlobalScope&&"undefined"!==typeof self&&"undefined"!==typeof self.DedicatedWorkerGlobalScope&&(self.onmessage=function(a){a=a.data;if("_GoJS"===a._GoJS)if(a.url)importScripts(a.url);else if(a.version)self.postMessage({_GoJS:"_GoJS",version:Q.version},void 0);else{var b=performance.now(),c=null;a.layout&&(c=kq(a.layout));var d=null;c&&c.Ru&&(d=new c.Ru);if(!d)throw Error("no registered Worker Layout: "+a.layout);d.network=qq(d,a,!0);
d.workerLayout=function(){var a=sq(d,d.network,!1);a._GoJS="_GoJS";a.time=performance.now()-b;self.postMessage(a,void 0);return!0};d.doLayout(new H)}});function nq(){this.Ru=null;this.py=this.j=this.name="";this.scripts=[];this.bf=null;this.sm=new yb}function fq(a){ab(this);G&&!a&&v("LayoutNetwork constructor requires non-null Layout argument");this.Kc=a;this.Df=new I;this.ye=new I;this.Xs=new yb;this.Ss=new yb}
fq.prototype.clear=function(){if(this.Df)for(var a=this.Df.iterator;a.next();)a.value.clear();if(this.ye)for(a=this.ye.iterator;a.next();)a.value.clear();this.Df=new I;this.ye=new I;this.Xs=new yb;this.Ss=new yb};
fq.prototype.toString=function(a){void 0===a&&(a=0);var b="LayoutNetwork"+(null!==this.layout?"("+this.layout.toString()+")":"");if(0>=a)return b;b+=" vertexes: "+this.Df.count+" edges: "+this.ye.count;if(1<a){for(var c=this.Df.iterator;c.next();)b+="\n    "+c.value.toString(a-1);for(c=this.ye.iterator;c.next();)b+="\n    "+c.value.toString(a-1)}return b};fq.prototype.createVertex=function(){return new tq(this)};fq.prototype.createEdge=function(){return new uq(this)};
fq.prototype.yg=function(a,b,c){if(null!==a){void 0===b&&(b=!1);A(b,"boolean",fq,"addParts:toplevelonly");void 0===c&&(c=null);null===c&&(c=function(a){if(a instanceof V)return!a.isLinkLabel;if(a instanceof R){var b=a.fromNode;if(null===b||b.isLinkLabel)return!1;a=a.toNode;return null===a||a.isLinkLabel?!1:!0}return!1});for(a=a.iterator;a.next();){var d=a.value;if(d instanceof V&&(!b||d.isTopLevel)&&d.canLayout()&&c(d))if(d instanceof yf&&null===d.layout)this.yg(d.memberParts,!1);else if(null===this.Ui(d)){var e=
this.createVertex();e.node=d;this.zg(e)}}for(a.reset();a.next();)if(d=a.value,d instanceof R&&(!b||d.isTopLevel)&&d.canLayout()&&c(d)&&null===this.hq(d)){var f=d.fromNode;e=d.toNode;null!==f&&null!==e&&f!==e&&(f=this.findGroupVertex(f),e=this.findGroupVertex(e),null!==f&&null!==e&&this.qk(f,e,d))}}};
fq.prototype.findGroupVertex=function(a){if(null===a)return null;var b=a.findVisibleNode();if(null===b)return null;a=this.Ui(b);if(null!==a)return a;for(b=b.containingGroup;null!==b;){a=this.Ui(b);if(null!==a)return a;b=b.containingGroup}return null};t=fq.prototype;t.zg=function(a){if(null!==a){G&&w(a,tq,fq,"addVertex:vertex");this.Df.add(a);var b=a.node;null!==b&&this.Xs.add(b,a);a.network=this}};
t.Zj=function(a){if(null===a)return null;G&&w(a,V,fq,"addNode:node");var b=this.Ui(a);null===b&&(b=this.createVertex(),b.node=a,this.zg(b));return b};t.Vu=function(a){if(null!==a&&(G&&w(a,tq,fq,"deleteVertex:vertex"),vq(this,a))){for(var b=a.zd,c=b.count-1;0<=c;c--){var d=b.M(c);this.gk(d)}b=a.Md;for(a=b.count-1;0<=a;a--)c=b.M(a),this.gk(c)}};function vq(a,b){if(null===b)return!1;var c=a.Df.remove(b);c&&(b=b.node,null!==b&&a.Xs.remove(b));return c}
t.Nz=function(a){null!==a&&(G&&w(a,V,fq,"deleteNode:node"),a=this.Ui(a),null!==a&&this.Vu(a))};t.Ui=function(a){if(null===a)return null;G&&w(a,V,fq,"findVertex:node");return this.Xs.K(a)};t.dm=function(a){if(null!==a){G&&w(a,uq,fq,"addEdge:edge");wq(this,a);var b=a.toVertex;null!==b&&b.Hu(a);b=a.fromVertex;null!==b&&b.Fu(a)}};function wq(a,b){if(null!==b){a.ye.add(b);var c=b.link;null!==c&&null===a.hq(c)&&a.Ss.add(c,b);b.network=a}}
t.pz=function(a){if(null===a)return null;G&&w(a,R,fq,"addLink:link");var b=a.fromNode,c=a.toNode,d=this.hq(a);null===d?(d=this.createEdge(),d.link=a,null!==b&&(d.fromVertex=this.Zj(b)),null!==c&&(d.toVertex=this.Zj(c)),this.dm(d)):(null!==b?d.fromVertex=this.Zj(b):d.fromVertex=null,null!==c?d.toVertex=this.Zj(c):d.toVertex=null);return d};t.gk=function(a){if(null!==a){G&&w(a,uq,fq,"deleteEdge:edge");var b=a.toVertex;null!==b&&b.Uu(a);b=a.fromVertex;null!==b&&b.Tu(a);xq(this,a)}};
function xq(a,b){null!==b&&a.ye.remove(b)&&(b=b.link,null!==b&&a.Ss.remove(b))}t.Mz=function(a){null!==a&&(G&&w(a,R,fq,"deleteLink:link"),a=this.hq(a),null!==a&&this.gk(a))};t.hq=function(a){if(null===a)return null;G&&w(a,R,fq,"findEdge:link");return this.Ss.K(a)};
t.qk=function(a,b,c){if(null===a||null===b)return null;G&&(w(a,tq,fq,"linkVertexes:fromVertex"),w(b,tq,fq,"linkVertexes:toVertex"),null!==c&&w(c,R,fq,"linkVertexes:link"));if(a.network===this&&b.network===this){var d=this.createEdge();d.link=c;d.fromVertex=a;d.toVertex=b;this.dm(d);return d}return null};t.Em=function(a){if(null!==a){G&&w(a,uq,fq,"reverseEdge:edge");var b=a.fromVertex,c=a.toVertex;null!==b&&null!==c&&(b.Tu(a),c.Uu(a),a.Em(),b.Hu(a),c.Fu(a))}};
t.fq=function(){for(var a=Na(),b=this.ye.iterator;b.next();){var c=b.value;c.fromVertex===c.toVertex&&a.push(c)}b=a.length;for(c=0;c<b;c++)this.gk(a[c]);Pa(a)};fq.prototype.deleteArtificialVertexes=function(){for(var a=Na(),b=this.Df.iterator;b.next();){var c=b.value;null===c.node&&null===c.data&&a.push(c)}c=a.length;for(b=0;b<c;b++)this.Vu(a[b]);b=Na();for(c=this.ye.iterator;c.next();){var d=c.value;null===d.link&&null===d.data&&b.push(d)}c=b.length;for(d=0;d<c;d++)this.gk(b[d]);Pa(a);Pa(b)};
function yq(a){for(var b=Na(),c=a.ye.iterator;c.next();){var d=c.value;null!==d.fromVertex&&null!==d.toVertex||b.push(d)}c=b.length;for(d=0;d<c;d++)a.gk(b[d]);Pa(b)}
fq.prototype.Qy=function(a){void 0===a&&(a=!0);a&&(this.deleteArtificialVertexes(),yq(this),this.fq());a=new H;for(var b=!0;b;){b=!1;for(var c=this.Df.iterator;c.next();){var d=c.value;if(0<d.zd.count||0<d.Md.count){b=this.layout.createNetwork();a.add(b);zq(this,b,d);b=!0;break}}}a.sort(function(a,b){return null===a||null===b||a===b?0:b.vertexes.count-a.vertexes.count});return a};
function zq(a,b,c){if(null!==c&&c.network!==b){vq(a,c);b.zg(c);for(var d=c.sourceEdges;d.next();){var e=d.value;e.network!==b&&(xq(a,e),wq(b,e),zq(a,b,e.fromVertex))}for(d=c.destinationEdges;d.next();)c=d.value,c.network!==b&&(xq(a,c),wq(b,c),zq(a,b,c.toVertex))}}fq.prototype.Vz=function(){for(var a=new I,b=this.Df.iterator;b.next();)a.add(b.value.node);for(b=this.ye.iterator;b.next();)a.add(b.value.link);return a};
na.Object.defineProperties(fq.prototype,{layout:{configurable:!0,get:function(){return this.Kc},set:function(a){null!==a&&(this.Kc=a)}},vertexes:{configurable:!0,get:function(){return this.Df}},edges:{configurable:!0,get:function(){return this.ye}}});fq.prototype.findAllParts=fq.prototype.Vz;fq.prototype.splitIntoSubNetworks=fq.prototype.Qy;fq.prototype.deleteSelfEdges=fq.prototype.fq;fq.prototype.reverseEdge=fq.prototype.Em;fq.prototype.linkVertexes=fq.prototype.qk;
fq.prototype.findEdge=fq.prototype.hq;fq.prototype.deleteLink=fq.prototype.Mz;fq.prototype.deleteEdge=fq.prototype.gk;fq.prototype.addLink=fq.prototype.pz;fq.prototype.addEdge=fq.prototype.dm;fq.prototype.findVertex=fq.prototype.Ui;fq.prototype.deleteNode=fq.prototype.Nz;fq.prototype.deleteVertex=fq.prototype.Vu;fq.prototype.addNode=fq.prototype.Zj;fq.prototype.addVertex=fq.prototype.zg;fq.prototype.addParts=fq.prototype.yg;fq.className="LayoutNetwork";
function tq(a){ab(this);G&&!a&&v("LayoutVertex constructor requires non-null LayoutNetwork argument");this.Wb=a;this.j=(new M(0,0,10,10)).freeze();this.o=(new K(5,5)).freeze();this.yi=this.ob=null;this.zd=new H;this.Md=new H}
tq.prototype.serializeVertexProperties=function(a){a.id=lb(this);a.key=this.node?this.node.key:this.data?this.data.oi:void 0;void 0===a.key&&(a.key=null);a.x=this.bounds.x;a.y=this.bounds.y;a.qB=this.bounds.width;a.yA=this.bounds.height;a.fx=this.focus.x;a.fy=this.focus.y;var b=[];this.zd.each(function(a){b.push(lb(a))});a.Ny=b;var c=[];this.Md.each(function(a){c.push(lb(a))});a.Vx=c};
tq.prototype.deserializeVertexProperties=function(a,b,c){if(null!==a){this.x=a.x;this.y=a.y;this.width=a.qB;this.height=a.yA;this.focusX=a.fx;this.focusY=a.fy;var d=this;a.Ny&&a.Ny.forEach(function(a){(a=c.get(a))&&d.zd.add(a)});a.Vx&&a.Vx.forEach(function(a){(a=c.get(a))&&d.Md.add(a)})}};tq.prototype.clear=function(){this.yi=this.ob=null;this.zd=new H;this.Md=new H};
tq.prototype.toString=function(a){void 0===a&&(a=0);var b="LayoutVertex#"+lb(this);if(0<a&&(b+=null!==this.node?"("+this.node.toString()+")":"",1<a)){a="";for(var c=!0,d=this.zd.iterator;d.next();){var e=d.value;c?c=!1:a+=",";a+=e.toString(0)}e="";c=!0;for(d=this.Md.iterator;d.next();){var f=d.value;c?c=!1:e+=",";e+=f.toString(0)}b+=" sources: "+a+" destinations: "+e}return b};
tq.prototype.commit=function(){var a=this.ob;if(null!==a){var b=this.bounds,c=a.bounds;Ga(c)?(c.x=b.x,c.y=b.y,c.width=b.width,c.height=b.height):a.bounds=b.copy()}else if(a=this.node,null!==a){b=this.bounds;if(!(a instanceof yf)){c=M.alloc();var d=this.network.layout.Xi(a,c),e=a.locationObject.ja(Ic);if(d.s()&&e.s()){a.moveTo(b.x+this.focusX-(e.x-d.x),b.y+this.focusY-(e.y-d.y));M.free(c);return}M.free(c)}a.moveTo(b.x,b.y)}};
tq.prototype.Hu=function(a){null!==a&&(G&&w(a,uq,tq,"addSourceEdge:edge"),this.zd.contains(a)||this.zd.add(a))};tq.prototype.Uu=function(a){null!==a&&(G&&w(a,uq,tq,"deleteSourceEdge:edge"),this.zd.remove(a))};tq.prototype.Fu=function(a){null!==a&&(G&&w(a,uq,tq,"addDestinationEdge:edge"),this.Md.contains(a)||this.Md.add(a))};tq.prototype.Tu=function(a){null!==a&&(G&&w(a,uq,tq,"deleteDestinationEdge:edge"),this.Md.remove(a))};
function Aq(a,b){G&&w(a,tq,tq,"standardComparer:m");G&&w(b,tq,tq,"standardComparer:n");a=a.yi;b=b.yi;return a?b?(a=a.text,b=b.text,a<b?-1:a>b?1:0):1:null!==b?-1:0}
na.Object.defineProperties(tq.prototype,{sourceEdgesArrayAccess:{configurable:!0,get:function(){return this.zd._dataArray}},destinationEdgesArrayAccess:{configurable:!0,get:function(){return this.Md._dataArray}},data:{configurable:!0,get:function(){return this.ob},set:function(a){this.ob=a;if(null!==a&&a.bounds){var b=a.bounds;a=b.x;var c=b.y,d=b.width;b=b.height;this.o.h(d/2,b/2);this.j.h(a,c,d,b)}}},node:{configurable:!0,get:function(){return this.yi},
set:function(a){if(this.yi!==a){G&&null!==a&&w(a,V,tq,"node");this.yi=a;a.Ya();var b=this.network.layout,c=M.alloc(),d=b.Xi(a,c);b=d.x;var e=d.y,f=d.width;d=d.height;isNaN(b)&&(b=0);isNaN(e)&&(e=0);this.j.h(b,e,f,d);M.free(c);if(!(a instanceof yf)&&(a=a.locationObject.ja(Ic),a.s())){this.o.h(a.x-b,a.y-e);return}this.o.h(f/2,d/2)}}},bounds:{configurable:!0,get:function(){return this.j},set:function(a){this.j.B(a)||(G&&w(a,M,tq,"bounds"),this.j.assign(a))}},focus:{configurable:!0,
get:function(){return this.o},set:function(a){this.o.B(a)||(G&&w(a,K,tq,"focus"),this.o.assign(a))}},centerX:{configurable:!0,get:function(){return this.j.x+this.o.x},set:function(a){var b=this.j;b.x+this.o.x!==a&&(G&&E(a,tq,"centerX"),b.ka(),b.x=a-this.o.x,b.freeze())}},centerY:{configurable:!0,get:function(){return this.j.y+this.o.y},set:function(a){var b=this.j;b.y+this.o.y!==a&&(G&&E(a,tq,"centerY"),b.ka(),b.y=a-this.o.y,b.freeze())}},focusX:{configurable:!0,
get:function(){return this.o.x},set:function(a){var b=this.o;b.x!==a&&(b.ka(),b.x=a,b.freeze())}},focusY:{configurable:!0,get:function(){return this.o.y},set:function(a){var b=this.o;b.y!==a&&(b.ka(),b.y=a,b.freeze())}},x:{configurable:!0,get:function(){return this.j.x},set:function(a){var b=this.j;b.x!==a&&(b.ka(),b.x=a,b.freeze())}},y:{configurable:!0,get:function(){return this.j.y},set:function(a){var b=this.j;b.y!==a&&(b.ka(),b.y=a,b.freeze())}},width:{configurable:!0,
enumerable:!0,get:function(){return this.j.width},set:function(a){var b=this.j;b.width!==a&&(b.ka(),b.width=a,b.freeze())}},height:{configurable:!0,get:function(){return this.j.height},set:function(a){var b=this.j;b.height!==a&&(b.ka(),b.height=a,b.freeze())}},network:{configurable:!0,get:function(){return this.Wb},set:function(a){G&&w(a,fq,tq,"network");this.Wb=a}},sourceVertexes:{configurable:!0,get:function(){for(var a=new I,b=this.sourceEdges;b.next();)a.add(b.value.fromVertex);
return a.iterator}},destinationVertexes:{configurable:!0,get:function(){for(var a=new I,b=this.destinationEdges;b.next();)a.add(b.value.toVertex);return a.iterator}},vertexes:{configurable:!0,get:function(){for(var a=new I,b=this.sourceEdges;b.next();)a.add(b.value.fromVertex);for(b=this.destinationEdges;b.next();)a.add(b.value.toVertex);return a.iterator}},sourceEdges:{configurable:!0,get:function(){return this.zd.iterator}},destinationEdges:{configurable:!0,
enumerable:!0,get:function(){return this.Md.iterator}},edges:{configurable:!0,get:function(){for(var a=new H,b=this.sourceEdges;b.next();)a.add(b.value);for(b=this.destinationEdges;b.next();)a.add(b.value);return a.iterator}},edgesCount:{configurable:!0,get:function(){return this.zd.count+this.Md.count}}});tq.prototype.deleteDestinationEdge=tq.prototype.Tu;tq.prototype.addDestinationEdge=tq.prototype.Fu;tq.prototype.deleteSourceEdge=tq.prototype.Uu;
tq.prototype.addSourceEdge=tq.prototype.Hu;tq.className="LayoutVertex";tq.standardComparer=Aq;
tq.smartComparer=function(a,b){G&&w(a,tq,tq,"smartComparer:m");G&&w(b,tq,tq,"smartComparer:n");if(null!==a){if(null!==b){a=a.yi;var c=b.yi;if(null!==a){if(null!==c){b=a.text.toLocaleLowerCase().split(/([+-]?[.]?\d+(?:\.\d*)?(?:e[+-]?\d+)?)/);a=c.text.toLocaleLowerCase().split(/([+-]?[.]?\d+(?:\.\d*)?(?:e[+-]?\d+)?)/);for(c=0;c<b.length;c++)if(""!==a[c]&&void 0!==a[c]){var d=parseFloat(b[c]),e=parseFloat(a[c]);if(isNaN(d))if(isNaN(e)){if(0!==b[c].localeCompare(a[c]))return b[c].localeCompare(a[c])}else return 1;
else{if(isNaN(e))return-1;if(0!==d-e)return d-e}}else if(""!==b[c])return 1;return""!==a[c]&&void 0!==a[c]?-1:0}return 1}return null!==c?-1:0}return 1}return null!==b?-1:0};function uq(a){ab(this);G&&!a&&v("LayoutEdge constructor requires non-null LayoutNetwork argument");this.Vb=a;this.kd=this.ad=this.wl=this.ob=null}uq.prototype.clear=function(){this.kd=this.ad=this.wl=this.ob=null};
uq.prototype.serializeEdgeProperties=function(a){a.id=lb(this);a.key=this.link?this.link.key:this.data?this.data.oi:void 0;void 0===a.key&&(a.key=null);a.from=this.fromVertex?lb(this.fromVertex):null;a.lB=this.toVertex?lb(this.toVertex):null};uq.prototype.deserializeEdgeProperties=function(a,b){if(null!==a){var c=b.get(a.from);c&&(this.fromVertex=c);if(a=b.get(a.lB))this.toVertex=a}};
uq.prototype.toString=function(a){void 0===a&&(a=0);var b="LayoutEdge#"+lb(this);0<a&&(b+=null!==this.wl?"("+this.wl.toString()+")":"",1<a&&(b+=" "+(this.ad?this.ad.toString():"null")+" --\x3e "+(this.kd?this.kd.toString():"null")));return b};uq.prototype.Em=function(){var a=this.ad;this.ad=this.kd;this.kd=a};uq.prototype.commit=function(){};uq.prototype.my=function(a){G&&w(a,tq,uq,"getOtherVertex:v");return this.kd===a?this.ad:this.ad===a?this.kd:null};
na.Object.defineProperties(uq.prototype,{network:{configurable:!0,get:function(){return this.Vb},set:function(a){G&&w(a,fq,uq,"network");this.Vb=a}},data:{configurable:!0,get:function(){return this.ob},set:function(a){this.ob!==a&&(G&&null!==a&&A(a,"object",uq,"data"),this.ob=a)}},link:{configurable:!0,get:function(){return this.wl},set:function(a){this.wl!==a&&(G&&null!==a&&w(a,R,uq,"link"),this.wl=a)}},fromVertex:{configurable:!0,get:function(){return this.ad},
set:function(a){this.ad!==a&&(G&&null!==a&&w(a,tq,uq,"fromVertex"),this.ad=a)}},toVertex:{configurable:!0,get:function(){return this.kd},set:function(a){this.kd!==a&&(G&&null!==a&&w(a,tq,uq,"toVertex"),this.kd=a)}}});uq.prototype.getOtherVertex=uq.prototype.my;uq.className="LayoutEdge";
function Uk(a){zi.call(this);this.isViewportSized=!0;this.Vp=this.Wp=NaN;this.Kg=(new Hb(NaN,NaN)).freeze();this.wf=(new Hb(10,10)).freeze();this.Db=Bq;this.Nb=Cq;this.gd=Dq;this.Zc=Eq;a&&Object.assign(this,a)}ma(Uk,zi);Uk.prototype.cloneProtected=function(a){zi.prototype.cloneProtected.call(this,a);a.Wp=this.Wp;a.Vp=this.Vp;a.Kg.assign(this.Kg);a.wf.assign(this.wf);a.Db=this.Db;a.Nb=this.Nb;a.gd=this.gd;a.Zc=this.Zc};
Uk.prototype.mb=function(a){a.classType===Uk?a===Dq||a===Fq||a===Gq||a===Hq?this.sorting=a:a===Cq||a===Iq?this.arrangement=a:a===Bq||a===Jq?this.alignment=a:v("Unknown enum value: "+a):zi.prototype.mb.call(this,a)};
Uk.prototype.doLayout=function(a){G&&null===a&&v("Layout.doLayout(collection) argument must not be null but a Diagram, a Group, or an Iterable of Parts");this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);var b=this.Px(a);a=this.diagram;for(var c=b.copy().iterator;c.next();){var d=c.value;if(!d.Sh()||null===d.fromNode&&null===d.toNode){if(d.Ya(),d instanceof yf)for(d=d.memberParts;d.next();)b.remove(d.value)}else b.remove(d)}var e=b.Fa();if(0!==e.length){switch(this.sorting){case Hq:e.reverse();
break;case Dq:e.sort(this.comparer);break;case Fq:e.sort(this.comparer),e.reverse()}var f=this.wrappingColumn;isNaN(f)&&(f=0);var g=this.wrappingWidth;isNaN(g)&&null!==a?(b=a.padding,g=Math.max(a.viewportBounds.width-b.left-b.right,0)):g=Math.max(this.wrappingWidth,0);0>=f&&0>=g&&(f=1);b=this.spacing.width;isFinite(b)||(b=0);c=this.spacing.height;isFinite(c)||(c=0);null!==a&&a.Ea("Layout");d=[];switch(this.alignment){case Jq:var h=b,k=c,l=M.alloc(),m=Math.max(this.cellSize.width,1);if(!isFinite(m))for(var n=
m=0;n<e.length;n++){var p=this.Xi(e[n],l);m=Math.max(m,p.width)}m=Math.max(m+h,1);n=Math.max(this.cellSize.height,1);if(!isFinite(n))for(p=n=0;p<e.length;p++){var r=this.Xi(e[p],l);n=Math.max(n,r.height)}n=Math.max(n+k,1);p=this.arrangement;for(var q=r=this.arrangementOrigin.x,u=this.arrangementOrigin.y,x=0,y=0,z=0;z<e.length;z++){var B=e[z],D=this.Xi(B,l),C=Math.ceil((D.width+h)/m)*m,J=Math.ceil((D.height+k)/n)*n;switch(p){case Iq:var S=Math.abs(q-D.width);break;default:S=q+D.width}if(0<f&&x>f-1||
0<g&&0<x&&S-r>g)d.push(new M(0,u,g+h,y)),x=0,q=r,u+=y,y=0;y=Math.max(y,J);switch(p){case Iq:D=-D.width;break;default:D=0}B.moveTo(q+D,u);switch(p){case Iq:q-=C;break;default:q+=C}x++}d.push(new M(0,u,g+h,y));M.free(l);break;case Bq:k=g;m=f;n=b;p=c;g=M.alloc();r=Math.max(this.cellSize.width,1);f=u=l=0;h=K.alloc();for(q=0;q<e.length;q++)y=e[q],x=this.Xi(y,g),y=Jo(y,y.locationObject,y.locationSpot,h),l=Math.max(l,y.x),u=Math.max(u,x.width-y.x),f=Math.max(f,y.y);q=this.arrangement;switch(q){case Iq:l+=
n;break;default:u+=n}r=isFinite(r)?Math.max(r+n,1):Math.max(l+u,1);var T=y=this.arrangementOrigin.x;z=this.arrangementOrigin.y;u=0;k>=l&&(k-=l);l=B=0;C=Math.max(this.cellSize.height,1);D=f=0;J=!0;x=K.alloc();for(S=0;S<e.length;S++){var aa=e[S],W=this.Xi(aa,g),P=Jo(aa,aa.locationObject,aa.locationSpot,h);if(0<u)switch(q){case Iq:T=(T-y-(W.width-P.x))/r;T=L.da(Math.round(T),T)?Math.round(T):Math.floor(T);T=T*r+y;break;default:T=(T-y+P.x)/r,T=L.da(Math.round(T),T)?Math.round(T):Math.ceil(T),T=T*r+y}else switch(q){case Iq:B=
T+P.x+W.width;break;default:B=T-P.x}switch(q){case Iq:var qa=-(T+P.x)+B;break;default:qa=T+W.width-P.x-B}if(0<m&&u>m-1||0<k&&0<u&&qa>k){d.push(new M(0,J?z-f:z,k+n,D+f+p));for(T=0;T<u&&S!==u;T++){qa=e[S-u+T];var ia=Jo(qa,qa.locationObject,qa.locationSpot,x);qa.moveTo(qa.position.x,qa.position.y+f-ia.y)}D+=p;z=J?z+D:z+(D+f);u=D=f=0;T=y;J=!1}T===y&&(l=q===Iq?Math.max(l,W.width-P.x):Math.min(l,-P.x));f=Math.max(f,P.y);D=Math.max(D,W.height-P.y);isFinite(C)&&(D=Math.max(D,Math.max(W.height,C)-P.y));J?
aa.moveTo(T-P.x,z-P.y):aa.moveTo(T-P.x,z);switch(q){case Iq:T-=P.x+n;break;default:T+=W.width-P.x+n}u++}d.push(new M(0,z,k+n,(J?D:D+f)+p));if(e.length!==u)for(k=0;k<u;k++)m=e[e.length-u+k],n=Jo(m,m.locationObject,m.locationSpot,h),m.moveTo(m.position.x,m.position.y+f-n.y);K.free(h);K.free(x);if(q===Iq)for(e=0;e<d.length;e++)f=d[e],f.width+=l,f.x-=l;else for(e=0;e<d.length;e++)f=d[e],f.x>l&&(f.width+=f.x-l,f.x=l);M.free(g)}for(h=f=g=e=0;h<d.length;h++)k=d[h],e=Math.min(e,k.x),g=Math.min(g,k.y),f=Math.max(f,
k.x+k.width);this.arrangement===Iq?this.commitLayers(d,new K(e+b/2-(f+e),g-c/2)):this.commitLayers(d,new K(e-b/2,g-c/2));null!==a&&a.cb("Layout");this.isValidLayout=!0}};Uk.prototype.commitLayers=function(){};function Eq(a,b){G&&w(a,U,Uk,"standardComparer:a");G&&w(b,U,Uk,"standardComparer:b");a=a.text;b=b.text;return a<b?-1:a>b?1:0}
na.Object.defineProperties(Uk.prototype,{wrappingWidth:{configurable:!0,get:function(){return this.Wp},set:function(a){this.Wp!==a&&(A(a,"number",Uk,"wrappingWidth"),0<a||isNaN(a))&&(this.Wp=a,this.isViewportSized=isNaN(a),this.C())}},wrappingColumn:{configurable:!0,get:function(){return this.Vp},set:function(a){this.Vp!==a&&(A(a,"number",Uk,"wrappingColumn"),0<a||isNaN(a))&&(this.Vp=a,this.C())}},cellSize:{configurable:!0,get:function(){return this.Kg},set:function(a){w(a,
Hb,Uk,"cellSize");this.Kg.B(a)||(this.Kg.assign(a),this.C())}},spacing:{configurable:!0,get:function(){return this.wf},set:function(a){w(a,Hb,Uk,"spacing");this.wf.B(a)||(this.wf.assign(a),this.C())}},alignment:{configurable:!0,get:function(){return this.Db},set:function(a){this.Db!==a&&(db(a,Uk,Uk,"alignment"),a===Bq||a===Jq)&&(this.Db=a,this.C())}},arrangement:{configurable:!0,get:function(){return this.Nb},set:function(a){this.Nb!==a&&(db(a,Uk,Uk,"arrangement"),
a===Cq||a===Iq)&&(this.Nb=a,this.C())}},sorting:{configurable:!0,get:function(){return this.gd},set:function(a){this.gd!==a&&(db(a,Uk,Uk,"sorting"),a===Gq||a===Hq||a===Dq||a===Fq)&&(this.gd=a,this.C())}},comparer:{configurable:!0,get:function(){return this.Zc},set:function(a){this.Zc!==a&&(A(a,"function",Uk,"comparer"),this.Zc=a,this.C())}}});
var Jq=new F(Uk,"Position",0),Bq=new F(Uk,"Location",1),Cq=new F(Uk,"LeftToRight",2),Iq=new F(Uk,"RightToLeft",3),Gq=new F(Uk,"Forward",4),Hq=new F(Uk,"Reverse",5),Dq=new F(Uk,"Ascending",6),Fq=new F(Uk,"Descending",7);Uk.className="GridLayout";Uk.standardComparer=Eq;
Uk.smartComparer=function(a,b){G&&w(a,U,Uk,"standardComparer:a");G&&w(b,U,Uk,"standardComparer:b");if(null!==a){if(null!==b){a=a.text.toLocaleLowerCase().split(/([+-]?[.]?\d+(?:\.\d*)?(?:e[+-]?\d+)?)/);b=b.text.toLocaleLowerCase().split(/([+-]?[.]?\d+(?:\.\d*)?(?:e[+-]?\d+)?)/);for(var c=0;c<a.length;c++)if(""!==b[c]&&void 0!==b[c]){var d=parseFloat(a[c]),e=parseFloat(b[c]);if(isNaN(d))if(isNaN(e)){if(0!==a[c].localeCompare(b[c]))return a[c].localeCompare(b[c])}else return 1;else{if(isNaN(e))return-1;
if(0!==d-e)return d-e}}else if(""!==a[c])return 1;return""!==b[c]&&void 0!==b[c]?-1:0}return 1}return null!==b?-1:0};Uk.Position=Jq;Uk.Location=Bq;Uk.LeftToRight=Cq;Uk.RightToLeft=Iq;Uk.Forward=Gq;Uk.Reverse=Hq;Uk.Ascending=Dq;Uk.Descending=Fq;function vi(){this.Qo=new I;this.xo=new I;this.Ma=new I;this.gf=new yb;this.ff=new yb;this.Bj=new yb;this.D=null;this.Oq=!1}t=vi.prototype;t.clear=function(){this.Qo.clear();this.xo.clear();this.Ma.clear();this.gf.clear();this.ff.clear();this.Bj.clear()};
t.$e=function(a){G&&null!==a&&w(a,Q,vi,"setDiagram");this.D=a};t.Yi=function(a){if(a instanceof V){if(this.Qo.add(a),a instanceof yf){var b=a.containingGroup;null===b?this.D.Hi.add(a):b.Cl.add(a);b=a.layout;null!==b&&(b.diagram=this.D)}}else a instanceof R?this.xo.add(a):a instanceof Ke||this.Ma.add(a);b=a.data;null===b||a instanceof Ke||(a instanceof R?this.ff.add(b,a):this.gf.add(b,a))};
t.kc=function(a){a.$j();if(a instanceof V){if(this.Qo.remove(a),a instanceof yf){var b=a.containingGroup;null===b?this.D.Hi.remove(a):b.Cl.remove(a);b=a.layout;null!==b&&(b.diagram=null)}}else a instanceof R?this.xo.remove(a):a instanceof Ke||this.Ma.remove(a);b=a.data;null===b||a instanceof Ke||(a instanceof R?this.ff.remove(b):this.gf.remove(b))};
t.Rd=function(){for(var a=this.D.nodeTemplateMap.iterator;a.next();){var b=a.value,c=a.key;(!b.Tc()||b instanceof yf)&&v('Invalid node template in Diagram.nodeTemplateMap: template for "'+c+'" must be a Node or a simple Part, not a Group or Link: '+b)}for(a=this.D.groupTemplateMap.iterator;a.next();)b=a.value,c=a.key,b instanceof yf||v('Invalid group template in Diagram.groupTemplateMap: template for "'+c+'" must be a Group, not a normal Node or Link: '+b);for(a=this.D.linkTemplateMap.iterator;a.next();)b=
a.value,c=a.key,b instanceof R||v('Invalid link template in Diagram.linkTemplateMap: template for "'+c+'" must be a Link, not a normal Node or simple Part: '+b);a=Na();for(b=this.D.selection.iterator;b.next();)(c=b.value.data)&&a.push(c);b=Na();for(c=this.D.highlighteds.iterator;c.next();){var d=c.value.data;d&&b.push(d)}c=Na();for(d=this.nodes.iterator;d.next();){var e=d.value;null!==e.data&&(c.push(e.data),c.push(e.location))}for(d=this.links.iterator;d.next();)e=d.value,null!==e.data&&(c.push(e.data),
c.push(e.location));for(d=this.parts.iterator;d.next();)e=d.value,null!==e.data&&(c.push(e.data),c.push(e.location));this.removeAllModeledParts();this.addAllModeledParts();for(d=0;d<a.length;d++)e=this.Gc(a[d]),null!==e&&(e.isSelected=!0);for(d=0;d<b.length;d++)e=this.Gc(b[d]),null!==e&&(e.isHighlighted=!0);for(d=0;d<c.length;d+=2)e=this.Gc(c[d]),null!==e&&(e.location=c[d+1]);Pa(a);Pa(b);Pa(c)};vi.prototype.addAllModeledParts=function(){this.addModeledParts(this.diagram.model.nodeDataArray)};
vi.prototype.addModeledParts=function(a,b){var c=this,d=this.diagram.model;a.forEach(function(a){d.ab(a)&&Kq(c,a,!1)});a.forEach(function(a){d.ab(a)&&c.resolveReferencesForData(a)});!1!==b&&hk(this.diagram,!1)};
function Kq(a,b,c){if(void 0!==b&&null!==b&&!a.diagram.undoManager.isUndoingRedoing&&!a.gf.contains(b)){void 0===c&&(c=!0);a:{if(void 0!==b&&null!==b&&!a.D.undoManager.isUndoingRedoing&&!a.gf.contains(b)){var d=a.lq(b);var e=Vo(a,b,d);if(null!==e&&(og(e),e=e.copy(),null!==e)){var f=a.diagram.skipsModelSourceBindings;a.diagram.skipsModelSourceBindings=!0;e.Zf=d;e.ob=b;a.Oq&&(e.fh="Tool");a.diagram.add(e);e.ob=null;e.data=b;a.diagram.skipsModelSourceBindings=f;d=e;break a}}d=null}null!==d&&c&&a.resolveReferencesForData(b)}}
vi.prototype.insertLink=function(){return null};vi.prototype.resolveReferencesForData=function(){};vi.prototype.lq=function(a){return this.D.model.lq(a)};
function Vo(a,b,c){a=a.D;var d=a.model;d.Zi()&&d.Os(b)?(b=a.groupTemplateMap.K(c),null===b&&(b=a.groupTemplateMap.K(""),null===b&&(Lq||(Lq=!0,Fa('No Group template found for category "'+c+'"'),Fa("  Using default group template")),b=a.$y))):(b=a.nodeTemplateMap.K(c),null===b&&(b=a.nodeTemplateMap.K(""),null===b&&(Mq||(Mq=!0,Fa('No Node template found for category "'+c+'"'),Fa("  Using default node template")),b=a.bz)));return b}vi.prototype.getLinkCategoryForData=function(){return""};
vi.prototype.setLinkCategoryForData=function(){};vi.prototype.setFromNodeForLink=function(){};vi.prototype.setToNodeForLink=function(){};vi.prototype.findLinkTemplateForCategory=function(a){var b=this.D.linkTemplateMap.K(a);null===b&&(b=this.D.linkTemplateMap.K(""),null===b&&(Nq||(Nq=!0,Fa('No Link template found for category "'+a+'"'),Fa("  Using default link template")),b=this.D.az));return b};vi.prototype.removeAllModeledParts=function(){this.at(this.diagram.model.nodeDataArray)};
vi.prototype.at=function(a){var b=this;a.forEach(function(a){b.Dq(a)})};vi.prototype.Dq=function(a){a=this.Gc(a);null!==a&&(Oj(this.diagram,a,!1),this.unresolveReferencesForPart(a))};vi.prototype.unresolveReferencesForPart=function(){};vi.prototype.removeDataForLink=function(){};vi.prototype.findPartForKey=function(a){if(null===a||void 0===a)return null;a=this.D.model.cc(a);return null!==a?this.gf.K(a):null};
vi.prototype.Jb=function(a){if(null===a||void 0===a)return null;a=this.D.model.cc(a);if(null===a)return null;a=this.gf.K(a);return a instanceof V?a:null};vi.prototype.findLinkForKey=function(){return null};t=vi.prototype;t.Gc=function(a){if(null===a)return null;var b=this.gf.K(a);return null!==b?b:b=this.ff.K(a)};t.Ri=function(a){if(null===a)return null;a=this.gf.K(a);return a instanceof V?a:null};t.Fc=function(a){return null===a?null:this.ff.K(a)};
t.Ds=function(a){for(var b=0;b<arguments.length;++b);b=new I;for(var c=this.Qo.iterator;c.next();){var d=c.value,e=d.data;if(null!==e)for(var f=0;f<arguments.length;f++){var g=arguments[f];if(Ga(g)&&Oq(this,e,g)){b.add(d);break}}}return b.iterator};t.Cs=function(a){for(var b=0;b<arguments.length;++b);b=new I;for(var c=this.xo.iterator;c.next();){var d=c.value,e=d.data;if(null!==e)for(var f=0;f<arguments.length;f++){var g=arguments[f];if(Ga(g)&&Oq(this,e,g)){b.add(d);break}}}return b.iterator};
function Oq(a,b,c){for(var d in c){var e=b[d],f=c[d];if(Ha(f)){if(!Ha(e)||e.length<f.length)return!1;for(var g=0;g<e.length;g++){var h=f[g];if(void 0!==h&&!Pq(a,e[g],h))return!1}}else if(!Pq(a,e,f))return!1}return!0}function Pq(a,b,c){if("function"===typeof c){if(!c(b))return!1}else if(c instanceof RegExp){if(!b||!c.test(b.toString()))return!1}else if(Ga(b)&&Ga(c)){if(!Oq(a,b,c))return!1}else if(b!==c)return!1;return!0}
vi.prototype.doModelChanged=function(a){if(this.D){var b=this.D;if(a.model===b.model){var c=a.change;b.doModelChanged(a);if(b.ba){b.ba=!1;try{var d=a.modelChange;if(""!==d)if(c===se){if("nodeCategory"===d){var e=this.Gc(a.object),f=a.newValue;null!==e&&"string"===typeof f&&(e.category=f)}else"nodeDataArray"===d&&(this.at(a.oldValue),this.addModeledParts(a.newValue));b.isModified=!0}else if(c===ue){var g=a.newValue;"nodeDataArray"===d&&Ga(g)&&Kq(this,g);b.isModified=!0}else if(c===ve){var h=a.oldValue;
"nodeDataArray"===d&&Ga(h)&&this.Dq(h);b.isModified=!0}else c===te&&("SourceChanged"===d?null!==a.object?this.updateDataBindings(a.object,a.propertyName):(this.Mq(),this.updateAllTargetBindings()):"ModelDisplaced"===d&&this.Rd());else if(c===se){var k=a.propertyName,l=a.object;if(l===b.model){if("nodeKeyProperty"===k||"nodeCategoryProperty"===k)b.undoManager.isUndoingRedoing||this.Rd()}else this.updateDataBindings(l,k);b.isModified=!0}else if(c===ue||c===ve){var m=a.change===ue,n=m?a.newParam:a.oldParam,
p=m?a.newValue:a.oldValue,r=this.Bj.K(a.object);if(Array.isArray(r))for(a=0;a<r.length;a++){var q=r[a];if(m)un(q,p,n,!0);else if(!(0>n)){var u=n+ln(q);q.kc(u,!0);xn(q,u,n)}}b.isModified=!0}}finally{b.ba=!0}}}}};vi.prototype.updateAllTargetBindings=function(a){void 0===a&&(a="");for(var b=this.parts.iterator;b.next();)b.value.Ka(a);for(b=this.nodes.iterator;b.next();)b.value.Ka(a);for(b=this.links.iterator;b.next();)b.value.Ka(a)};
vi.prototype.Mq=function(){for(var a=this.D.model,b=new I,c=a.nodeDataArray,d=0;d<c.length;d++)b.add(c[d]);var e=[];this.nodes.each(function(a){null===a.data||b.contains(a.data)||e.push(a.data)});this.parts.each(function(a){null===a.data||b.contains(a.data)||e.push(a.data)});e.forEach(function(b){Qq(a,b,!1)});for(d=0;d<c.length;d++){var f=c[d];null===this.Gc(f)&&Rq(a,f,!1)}this.refreshDataBoundLinks();for(c=this.parts.iterator;c.next();)c.value.updateRelationshipsFromData();for(c=this.nodes.iterator;c.next();)c.value.updateRelationshipsFromData();
for(c=this.links.iterator;c.next();)c.value.updateRelationshipsFromData()};vi.prototype.refreshDataBoundLinks=function(){};vi.prototype.updateRelationshipsFromData=function(){};
vi.prototype.updateDataBindings=function(a,b){if("string"===typeof b){var c=this.Gc(a);if(null!==c)c.Ka(b);else{c=null;for(var d=this.Bj.iterator;d.next();){for(var e=d.value,f=0;f<e.length;f++){var g=e[f].by(a);null!==g&&(null===c&&(c=Na()),c.push(g))}if(null!==c)break}if(null!==c){for(d=0;d<c.length;d++)c[d].Ka(b);Pa(c)}}a===this.diagram.model.modelData&&this.updateAllTargetBindings(b)}};
function Kj(a,b){var c=b.ni;if(Ha(c)){var d=a.Bj.K(c);if(null===d)d=[],d.push(b),a.Bj.add(c,d);else{for(a=0;a<d.length;a++)if(d[a]===b)return;d.push(b)}}}function Nj(a,b,c){Ij(b,function(a){a=a.W.m;for(var b=a.length,d=0;d<b;d++)fk(c,a[d])});var d=b.ni;if(Ha(d)){var e=a.Bj.K(d);if(null!==e)for(var f=0;f<e.length;f++)if(e[f]===b){e.splice(f,1);0===e.length&&a.Bj.remove(d);break}}}
vi.prototype.ek=function(a,b,c){void 0===c&&(c=!1);var d=new yb;if(Ha(a))for(var e=0;e<a.length;e++)Sq(this,a[e],b,d,c);else for(a=a.iterator;a.next();)Sq(this,a.value,b,d,c);if(null!==b){c=b.model;a=b.toolManager.findTool("Dragging");a=null!==a?a.dragOptions.dragsLink:b.Bn.dragsLink;e=new I;for(var f=new yb,g=d.iterator;g.next();){var h=g.value;if(h instanceof R)a||null!==h.fromNode&&null!==h.toNode||e.add(h);else if(h instanceof V&&null!==h.data&&c.rm()){var k=h;h=g.key;var l=h.Cg();null!==l&&(l=
d.K(l),null!==l?(c.pe(k.data,c.va(l.data)),k=b.Fc(k.data),h=h.Ti(),null!==h&&null!==k&&f.add(h,k)):c.pe(k.data,void 0))}}0<e.count&&b.bt(e,!1);if(0<f.count)for(c=f.iterator;c.next();)d.add(c.key,c.value)}if(null!==b&&null!==this.D&&(b=b.model,c=b.afterCopyFunction,null!==c)){var m=new yb;d.each(function(a){null!==a.key.data&&m.add(a.key.data,a.value.data)});c(m,b,this.D.model)}for(b=d.iterator;b.next();)b.value.Ka();return d};
function Sq(a,b,c,d,e){if(null===b||e&&!b.canCopy())return null;if(d.contains(b))return d.K(b);var f=a.copyPartData(b,c);if(!(f instanceof U))return null;f.isSelected=!1;f.isHighlighted=!1;d.add(b,f);if(b instanceof V){for(var g=b.linksConnected;g.next();){var h=g.value;if(h.fromNode===b){var k=d.K(h);null!==k&&(k.fromNode=f)}h.toNode===b&&(h=d.K(h),null!==h&&(h.toNode=f))}if(b instanceof yf&&f instanceof yf)for(b=b.memberParts;b.next();)g=Sq(a,b.value,c,d,e),g instanceof R||null===g||(g.containingGroup=
f)}else if(b instanceof R&&f instanceof R)for(g=b.fromNode,null!==g&&(g=d.K(g),null!==g&&(f.fromNode=g)),g=b.toNode,null!==g&&(g=d.K(g),null!==g&&(f.toNode=g)),b=b.labelNodes;b.next();)g=Sq(a,b.value,c,d,e),null!==g&&g instanceof V&&(g.labeledLink=f);return f}
vi.prototype.copyPartData=function(a,b){var c=null,d=a.data;if(null!==d&&null!==b){var e=b.model;a instanceof R||(d=e.copyNodeData(d),Ga(d)&&(e.Ef(d),c=b.Gc(d)))}else og(a),c=a.copy(),null!==c&&(e=this.D,null!==b?b.add(c):null!==d&&null!==e&&null!==e.commandHandler&&e.commandHandler.copiesClipboardData&&(b=e.model,e=null,c instanceof R||(e=b.copyNodeData(d)),Ga(e)&&(c.data=e)));return c};
na.Object.defineProperties(vi.prototype,{nodes:{configurable:!0,get:function(){return this.Qo}},links:{configurable:!0,get:function(){return this.xo}},parts:{configurable:!0,get:function(){return this.Ma}},diagram:{configurable:!0,get:function(){return this.D}},addsToTemporaryLayer:{configurable:!0,get:function(){return this.Oq},set:function(a){A(a,"boolean",vi,"addsToTemporaryLayer");this.Oq=a}}});
vi.prototype.updateAllRelationshipsFromData=vi.prototype.Mq;vi.prototype.findLinksByExample=vi.prototype.Cs;vi.prototype.findNodesByExample=vi.prototype.Ds;vi.prototype.findLinkForData=vi.prototype.Fc;vi.prototype.findNodeForData=vi.prototype.Ri;vi.prototype.findPartForData=vi.prototype.Gc;vi.prototype.findNodeForKey=vi.prototype.Jb;vi.prototype.removeModeledPart=vi.prototype.Dq;vi.prototype.removeModeledParts=vi.prototype.at;vi.prototype.rebuildParts=vi.prototype.Rd;var Mq=!1,Lq=!1,Nq=!1;
vi.className="PartManager";function Tq(a){vi.apply(this,arguments)}ma(Tq,vi);Tq.prototype.addAllModeledParts=function(){var a=this.diagram.model;this.addModeledParts(a.nodeDataArray);Uq(this,a.linkDataArray)};Tq.prototype.addModeledParts=function(a){vi.prototype.addModeledParts.call(this,a,!1);for(a=this.links.iterator;a.next();)Wo(a.value);hk(this.diagram,!1)};function Uq(a,b){b.forEach(function(b){Vq(a,b)});hk(a.diagram,!1)}
function Vq(a,b){if(void 0!==b&&null!==b&&!a.diagram.undoManager.isUndoingRedoing&&!a.ff.contains(b)){var c=a.getLinkCategoryForData(b),d=a.findLinkTemplateForCategory(c);if(null!==d){og(d);var e=d.copy();if(null!==e){d=a.diagram.skipsModelSourceBindings;a.diagram.skipsModelSourceBindings=!0;e.Zf=c;e.ob=b;c=a.diagram.model;var f=Wq(c,b,!0);""!==f&&(e.fromPortId=f);f=Xq(c,b,!0);void 0!==f&&(f=a.Jb(f),f instanceof V&&(e.fromNode=f));f=Wq(c,b,!1);""!==f&&(e.toPortId=f);f=Xq(c,b,!1);void 0!==f&&(f=a.Jb(f),
f instanceof V&&(e.toNode=f));c=c.Nf(b);Array.isArray(c)&&c.forEach(function(b){b=a.Jb(b);null!==b&&(b.labeledLink=e)});a.Oq&&(e.fh="Tool");a.diagram.add(e);e.ob=null;e.data=b;a.diagram.skipsModelSourceBindings=d}}}}Tq.prototype.removeAllModeledParts=function(){var a=this.diagram.model;Yq(this,a.linkDataArray);this.at(a.nodeDataArray)};function Yq(a,b){b.forEach(function(b){a.Dq(b)})}Tq.prototype.getLinkCategoryForData=function(a){return this.diagram.model.Gs(a)};
Tq.prototype.setLinkCategoryForData=function(a,b){return this.diagram.model.Gq(a,b)};Tq.prototype.setFromNodeForLink=function(a,b){var c=this.diagram.model;c.Uv(a.data,c.va(null!==b?b.data:null))};Tq.prototype.setToNodeForLink=function(a,b){var c=this.diagram.model;c.Yv(a.data,c.va(null!==b?b.data:null))};Tq.prototype.removeDataForLink=function(a){this.diagram.model.zm(a.data)};
Tq.prototype.findPartForKey=function(a){var b=vi.prototype.findPartForKey.call(this,a);return null===b&&(a=this.diagram.model.Oh(a),null!==a)?this.ff.K(a):b};Tq.prototype.findLinkForKey=function(a){if(null===a||void 0===a)return null;a=this.diagram.model.Oh(a);return null!==a?this.ff.K(a):null};
Tq.prototype.doModelChanged=function(a){var b=this;vi.prototype.doModelChanged.call(this,a);if(this.diagram){var c=this.diagram;if(a.model===c.model){var d=a.change;if(c.ba){c.ba=!1;try{var e=a.modelChange;if(""!==e)if(d===se){if("linkFromKey"===e){var f=this.Fc(a.object);if(null!==f){var g=this.Jb(a.newValue);f.fromNode=g}}else if("linkToKey"===e){var h=this.Fc(a.object);if(null!==h){var k=this.Jb(a.newValue);h.toNode=k}}else if("linkFromPortId"===e){var l=this.Fc(a.object);if(null!==l){var m=a.newValue;
"string"===typeof m&&(l.fromPortId=m)}}else if("linkToPortId"===e){var n=this.Fc(a.object);if(null!==n){var p=a.newValue;"string"===typeof p&&(n.toPortId=p)}}else if("nodeGroupKey"===e){var r=this.Gc(a.object);if(null!==r){var q=a.newValue;if(void 0!==q){var u=this.Jb(q);u instanceof yf?r.containingGroup=u:r.containingGroup=null}else r.containingGroup=null}}else if("linkLabelKeys"===e){var x=this.Fc(a.object);if(null!==x){var y=a.oldValue,z=a.newValue;Array.isArray(y)&&y.forEach(function(a){0<=z.indexOf(a)||
(a=b.Jb(a),null!==a&&(a.labeledLink=null))});Array.isArray(z)&&z.forEach(function(a){a=b.Jb(a);null!==a&&(a.labeledLink=x)})}}else if("linkCategory"===e){var B=this.Fc(a.object),D=a.newValue;null!==B&&"string"===typeof D&&(B.category=D)}else"linkDataArray"===e&&(Yq(this,a.oldValue),Uq(this,a.newValue));c.isModified=!0}else if(d===ue){var C=a.newValue;if("linkDataArray"===e&&"object"===typeof C&&null!==C)Vq(this,C);else if("linkLabelKeys"===e&&Zq(C)){var J=this.Fc(a.object),S=this.Jb(C);null!==J&&
null!==S&&(S.labeledLink=J)}c.isModified=!0}else{if(d===ve){var T=a.oldValue;if("linkDataArray"===e&&"object"===typeof T&&null!==T)this.Dq(T);else if("linkLabelKeys"===e&&Zq(T)){var aa=this.Jb(T);null!==aa&&(aa.labeledLink=null)}c.isModified=!0}}else if(d===se){var W=a.propertyName;a.object!==c.model||"linkFromKeyProperty"!==W&&"linkToKeyProperty"!==W&&"linkFromPortIdProperty"!==W&&"linkToPortIdProperty"!==W&&"linkLabelKeysProperty"!==W&&"nodeIsGroupProperty"!==W&&"nodeGroupKeyProperty"!==W&&"linkCategoryProperty"!==
W||c.undoManager.isUndoingRedoing||this.Rd();c.isModified=!0}}finally{c.ba=!0}}}}};Tq.prototype.refreshDataBoundLinks=function(){var a=this,b=this.diagram.model,c=new I,d=b.linkDataArray;d.forEach(function(a){c.add(a)});var e=[];this.links.each(function(a){null===a.data||c.contains(a.data)||e.push(a.data)});e.forEach(function(a){$q(b,a,!1)});d.forEach(function(c){null===a.Fc(c)&&ar(b,c,!1)})};
Tq.prototype.updateRelationshipsFromData=function(a){var b=a.data;if(null!==b){var c=a.diagram;if(null!==c){var d=c.model;if(a instanceof R){var e=Xq(d,b,!0);e=c.Jb(e);a.fromNode=e;e=Xq(d,b,!1);e=c.Jb(e);a.toNode=e;b=d.Nf(b);if(0<b.length||0<a.labelNodes.count){if(1===b.length&&1===a.labelNodes.count){e=b[0];var f=a.labelNodes.first();if(d.va(f.data)===e)return}e=(new I).addAll(b);var g=new I;a.labelNodes.each(function(a){null!==a.data&&(a=d.va(a.data),void 0!==a&&g.add(a))});b=g.copy();b.Cq(e);e=
e.copy();e.Cq(g);if(0<b.count||0<e.count)b.each(function(b){b=c.Jb(b);null!==b&&b.labeledLink===a&&(b.labeledLink=null)}),e.each(function(b){b=c.Jb(b);null!==b&&b.labeledLink!==a&&(b.labeledLink=a)})}}else!(a instanceof Ke)&&(b=d.Ph(b),b=c.findPartForKey(b),null===b||b instanceof yf)&&(a.containingGroup=b)}}};
Tq.prototype.resolveReferencesForData=function(a){var b=this.diagram.model,c=b.va(a);if(void 0!==c){var d=br(b,c),e=this.Gc(a);if(null!==d&&null!==e){d=d.iterator;for(var f={};d.next();){var g=d.value;b.ab(g)?e instanceof yf&&b.Ph(g)===c&&(g=this.Gc(g),null!==g&&(g.containingGroup=e)):(f.link=this.Fc(g),null!==f.link&&e instanceof V&&(Xq(b,g,!0)===c&&(f.link.fromNode=e),Xq(b,g,!1)===c&&(f.link.toNode=e),g=b.Nf(g),Array.isArray(g)&&g.some(function(a){return function(b){return b===c?(e.labeledLink=
a.link,!0):!1}}(f))));f={link:f.link}}cr(b,c)}a=b.Ph(a);void 0!==a&&(a=this.Jb(a),a instanceof yf&&(e.containingGroup=a))}};Tq.prototype.unresolveReferencesForPart=function(a){var b=this.diagram.model;if(a instanceof V){var c=b.va(a.data);if(void 0!==c){for(var d=a.linksConnected;d.next();)dr(b,c,d.value.data);a.isLinkLabel&&(d=a.labeledLink,null!==d&&dr(b,c,d.data));if(a instanceof yf)for(a=a.memberParts;a.next();)d=a.value.data,b.ab(d)&&dr(b,c,d)}}};
Tq.prototype.copyPartData=function(a,b){var c=vi.prototype.copyPartData.call(this,a,b);if(a instanceof R)if(a=a.data,null!==a&&null!==b){var d=b.model;a=d.eq(a);"object"===typeof a&&null!==a&&(d.Mi(a),c=b.Fc(a))}else null!==c&&(b=this.diagram,null!==a&&null!==b&&null!==b.commandHandler&&b.commandHandler.copiesClipboardData&&(b=b.model.eq(a),"object"===typeof b&&null!==b&&(c.data=b)));return c};
Tq.prototype.insertLink=function(a,b,c,d){var e=this.diagram,f=e.model,g=e.toolManager.findTool("Linking"),h="";null!==a&&(null===b&&(b=a),h=b.portId,null===h&&(h=""));b="";null!==c&&(null===d&&(d=c),b=d.portId,null===b&&(b=""));d=g.archetypeLinkData;if(d instanceof R){if(og(d),f=d.copy(),null!==f)return f.fromNode=a,f.fromPortId=h,f.toNode=c,f.toPortId=b,e.add(f),a=g.archetypeLabelNodeData,a instanceof V&&(og(a),a=a.copy(),null!==a&&(a.labeledLink=f,e.add(a))),f}else if(null!==d&&(d=f.eq(d),"object"===
typeof d&&null!==d))return null!==a&&er(f,d,f.va(a.data),!0),fr(f,d,h,!0),null!==c&&er(f,d,f.va(c.data),!1),fr(f,d,b,!1),f.Mi(d),a=g.archetypeLabelNodeData,null===a||a instanceof V||(a=f.copyNodeData(a),"object"===typeof a&&null!==a&&(f.Ef(a),a=f.va(a),void 0!==a&&f.Gu(d,a))),e.Fc(d);return null};Tq.prototype.findLinkForKey=Tq.prototype.findLinkForKey;Tq.prototype.findPartForKey=Tq.prototype.findPartForKey;Tq.prototype.removeAllModeledParts=Tq.prototype.removeAllModeledParts;
Tq.prototype.addModeledParts=Tq.prototype.addModeledParts;Tq.prototype.addAllModeledParts=Tq.prototype.addAllModeledParts;Tq.className="GraphLinksPartManager";function gr(){vi.apply(this,arguments);this.th=null}ma(gr,vi);
function hr(a,b,c){if(null!==b&&null!==c){var d=a.diagram.toolManager.findTool("Linking"),e=b,f=c;if(a.diagram.isTreePathToChildren)for(b=f.linksConnected;b.next();){if(b.value.toNode===f)return}else for(e=c,f=b,b=e.linksConnected;b.next();)if(b.value.fromNode===e)return;if(null===d||!Of(d,e,f,null,!0))if(d=a.getLinkCategoryForData(c.data),b=a.findLinkTemplateForCategory(d),null!==b&&(og(b),b=b.copy(),null!==b)){var g=a.diagram.skipsModelSourceBindings;a.diagram.skipsModelSourceBindings=!0;b.Zf=d;
b.ob=c.data;b.fromNode=e;b.toNode=f;a.diagram.add(b);b.ob=null;b.data=c.data;a.diagram.skipsModelSourceBindings=g}}}gr.prototype.getLinkCategoryForData=function(a){return this.diagram.model.Js(a)};gr.prototype.setLinkCategoryForData=function(a,b){this.diagram.model.ft(a,b)};
gr.prototype.setFromNodeForLink=function(a,b,c){var d=this.diagram.model;void 0===c&&(c=null);b=null!==b?b.data:null;if(this.diagram.isTreePathToChildren)d.pe(a.data,d.va(b));else{var e=this.th;this.th=a;null!==c&&d.pe(c.data,void 0);d.pe(b,d.va(null!==a.toNode?a.toNode.data:null));this.th=e}};
gr.prototype.setToNodeForLink=function(a,b,c){var d=this.diagram.model;void 0===c&&(c=null);b=null!==b?b.data:null;if(this.diagram.isTreePathToChildren){var e=this.th;this.th=a;null!==c&&d.pe(c.data,void 0);d.pe(b,d.va(null!==a.fromNode?a.fromNode.data:null));this.th=e}else d.pe(a.data,d.va(b))};gr.prototype.removeDataForLink=function(a){this.diagram.model.pe(a.data,void 0)};
gr.prototype.findLinkForKey=function(a){if(null===a||void 0===a)return null;a=this.diagram.model.cc(a);return null!==a?this.ff.K(a):null};
gr.prototype.doModelChanged=function(a){vi.prototype.doModelChanged.call(this,a);if(this.diagram){var b=this.diagram;if(a.model===b.model){var c=a.change;if(b.ba){b.ba=!1;try{var d=a.modelChange;if(""!==d){if(c===se){if("nodeParentKey"===d){var e=a.object,f=this.Jb(a.newValue),g=this.Ri(e);if(null!==this.th)null!==f&&(this.th.data=e,this.th.category=this.getLinkCategoryForData(e));else if(null!==g){var h=g.Ti();null!==h?null===f?b.remove(h):b.isTreePathToChildren?h.fromNode=f:h.toNode=f:hr(this,f,
g)}}else if("parentLinkCategory"===d){var k=this.Ri(a.object),l=a.newValue;if(null!==k&&"string"===typeof l){var m=k.Ti();null!==m&&(m.category=l)}}b.isModified=!0}}else if(c===se){var n=a.propertyName;a.object===b.model&&"nodeParentKeyProperty"===n&&(b.undoManager.isUndoingRedoing||this.Rd());b.isModified=!0}}finally{b.ba=!0}}}}};
gr.prototype.updateRelationshipsFromData=function(a){var b=a.data;if(null!==b){var c=a.diagram;if(null!==c){var d=c.model;a instanceof V&&(b=d.Qh(b),b=c.Jb(b),d=a.Cg(),b!==d&&(d=a.Ti(),null!==b?null!==d?c.isTreePathToChildren?d.fromNode=b:d.toNode=b:hr(this,b,a):null!==d&&Oj(c,d,!1)))}}};gr.prototype.updateDataBindings=function(a,b){vi.prototype.updateDataBindings.call(this,a,b);"string"===typeof b&&null!==this.Gc(a)&&(a=this.Fc(a),null!==a&&a.Ka(b))};
gr.prototype.resolveReferencesForData=function(a){var b=this.diagram.model,c=b.va(a);if(void 0!==c){var d=br(b,c),e=this.Gc(a);if(null!==d&&null!==e){for(d=d.iterator;d.next();){var f=d.value;b.ab(f)&&e instanceof V&&b.Qh(f)===c&&hr(this,e,this.Ri(f))}cr(b,c)}a=b.Qh(a);void 0!==a&&e instanceof V&&(a=this.Jb(a),hr(this,a,e))}};
gr.prototype.unresolveReferencesForPart=function(a){var b=this.diagram.model;if(a instanceof V){var c=b.va(a.data),d=this.Fc(a.data);if(null!==d){d.isSelected=!1;d.isHighlighted=!1;var e=d.layer;if(null!==e){var f=e.kc(-1,d,!1);0<=f&&this.diagram.bb(ve,"parts",e,d,null,f,null);f=d.layerChanged;null!==f&&f(d,e,null)}}d=this.diagram.isTreePathToChildren;for(a=a.linksConnected;a.next();)e=a.value,e=(d?e.toNode:e.fromNode).data,b.ab(e)&&dr(b,c,e)}};
gr.prototype.insertLink=function(a,b,c){b=this.diagram.model;var d=a,e=c;this.diagram.isTreePathToChildren||(d=c,e=a);return null!==d&&null!==e?(b.pe(e.data,b.va(d.data)),e.Ti()):null};gr.prototype.findLinkForKey=gr.prototype.findLinkForKey;gr.className="TreePartManager";
function Y(a,b){this.Gl=new I;this.El=new I;this.Kw=',\n  "insertedNodeKeys": ';this.Yy=',\n  "modifiedNodeData": ';this.Mw=',\n  "removedNodeKeys": ';this.Xh=null;ab(this);this.xn=this.ta="";this.dh=!1;this.j={};this.Bc=[];this.jb=new yb;this.zi="key";this.Uk=this.yl=null;this.on=this.pn=!1;this.rn=!0;this.$m=null;this.Kj="category";this.ag=new yb;this.au=new H;this.vh=!1;this.o=null;this.undoManager=new xe;void 0!==a&&(Ha(a)?this.nodeDataArray=a:Object.assign(this,a));b&&Object.assign(this,b)}
Y.prototype.cloneProtected=function(a){a.ta=this.ta;a.xn=this.xn;a.dh=this.dh;a.zi=this.zi;a.yl=this.yl;a.Uk=this.Uk;a.pn=this.pn;a.on=this.on;a.rn=this.rn;a.$m=this.$m;a.Kj=this.Kj};Y.prototype.copy=function(){var a=new this.constructor;this.cloneProtected(a);return a};Y.prototype.clear=function(){this.Bc=[];this.jb.clear();this.ag.clear();this.undoManager.clear()};
Y.prototype.toString=function(a){void 0===a&&(a=0);if(1<a)return this.Iq();var b=(""!==this.name?this.name:"")+" Model";if(0<a){b+="\n node data:";a=this.nodeDataArray;for(var c=a.length,d=0;d<c;d++){var e=a[d];b+=" "+this.va(e)+":"+Ra(e)}}return b};
Y.prototype.mB=function(a){w(a,re,Y,"toIncrementalData:e");a.change!==te&&v("Model.toIncrementalData argument is not a Transaction ChangedEvent:"+a.toString());var b=a.object;if(!(a.isTransactionFinished&&b instanceof we))return null;ir(this,b);a=this.ow(b,"FinishedUndo"===a.propertyName);this.Xh=null;return a};
Y.prototype.ow=function(a,b){var c=this,d=!1,e=new I,f=new I,g=new I,h=this.Xh;a.changes.each(function(a){a.model===c&&("nodeDataArray"===a.modelChange?a.change===ue?e.add(a.newValue):a.change===ve&&g.add(a.oldValue):c.ab(a.object)?f.add(a.object):a.change!==se||c.modelData!==a.object&&"modelData"!==a.propertyName?null!==a.object&&(h&&h.contains(a.object)?h.get(a.object).each(function(a){c.ab(a)&&f.add(a)}):a.object instanceof Y||c.aj()&&c.Ec(a.object)||jr(c,a.object).each(function(a){f.add(a)})):
d=!0)});var k=this.El;k.clear();e.each(function(a){k.add(c.va(a));b||f.add(a)});var l=this.Gl;l.clear();g.each(function(a){l.add(c.va(a));b&&f.add(a)});a=c.cloneDeep(f.Fa());var m=null;d&&(null===m&&(m={}),m.modelData=this.cloneDeep(this.modelData));0<k.count&&(null===m&&(m={}),b?m.removedNodeKeys=k.Fa():m.insertedNodeKeys=k.Fa());0<a.length&&(null===m&&(m={}),m.modifiedNodeData=a);0<l.count&&(null===m&&(m={}),b?m.insertedNodeKeys=l.Fa():m.removedNodeKeys=l.Fa());l.clear();k.clear();return m};
Y.prototype.cloneDeep=function(a){return kr(this,a,!0)};
function kr(a,b,c,d,e,f){function g(a,c){h?(void 0===a.__gohashid&&f.push(a),d.set(a,c)):(a=qb++,d.set(a,c),e.set(a,b))}if(!Ga(b))return b;f||(f=[]);var h=Object.isExtensible(b);d||(d=new yb);if(h){var k=d.get(b);if(k)return k}else for(e||(e=new yb),k=e.iterator;k.next();){var l=k.key;if(k.value===b&&(l=d.get(l)))return l}if(Array.isArray(b)){k=[];g(b,k);for(var m=0;m<b.length;m++)k.push(kr(a,b[m],!1,d,e,f))}else if(b instanceof K||b instanceof Hb||b instanceof M||b instanceof fc||b instanceof Ib)k=
b.copy(),g(b,k);else{if(b instanceof vl||b instanceof N||b instanceof F)return b;if(b instanceof H)k=(new H).addAll(kr(a,b.Fa(),!1,d,e,f)),g(b,k);else if(b instanceof I)k=(new I).addAll(kr(a,b.Fa(),!1,d,e,f)),g(b,k);else if(b instanceof yb)k=(new yb).addAll(kr(a,b.Fa(),!1,d,e,f)),g(b,k);else if(b instanceof Date)k=new Date(b.getTime()),g(b,k);else if(b instanceof RegExp)k=new RegExp(b),g(b,k),k.lastIndex=b.lastIndex;else if("function"===typeof b.copy)k=b.copy(),g(b,k);else for(m in k={},g(b,k),b)"__gohashid"!==
m&&(k[m]=kr(a,b[m],!1,d,e,f))}c&&f.forEach(function(a){delete a.__gohashid});return k}t=Y.prototype;t.quote=function(a){return JSON.stringify(a).replace(/[\u007F-\uFFFF]/g,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).substr(-4)})};
t.Qm=function(){var a="";""!==this.name&&(a+=',\n  "name": '+this.quote(this.name));""!==this.dataFormat&&(a+=',\n  "dataFormat": '+this.quote(this.dataFormat));this.isReadOnly&&(a+=',\n  "isReadOnly": '+this.isReadOnly);"key"!==this.nodeKeyProperty&&"string"===typeof this.nodeKeyProperty&&(a+=',\n  "nodeKeyProperty": '+this.quote(this.nodeKeyProperty));this.copiesArrays&&(a+=',\n  "copiesArrays": true');this.copiesArrayObjects&&(a+=',\n  "copiesArrayObjects": true');this.copiesKey||(a+=',\n  "copiesKey": false');
"category"!==this.nodeCategoryProperty&&"string"===typeof this.nodeCategoryProperty&&(a+=',\n  "nodeCategoryProperty": '+this.quote(this.nodeCategoryProperty));return a};
t.Aq=function(a){a.name&&(this.name=a.name);a.dataFormat&&(this.dataFormat=a.dataFormat);a.isReadOnly&&(this.isReadOnly=!0);a.nodeKeyProperty&&(this.nodeKeyProperty=a.nodeKeyProperty);a.copiesArrays&&(this.copiesArrays=!0);a.copiesArrayObjects&&(this.copiesArrayObjects=!0);!1===a.copiesKey&&(this.copiesKey=!1);a.nodeCategoryProperty&&(this.nodeCategoryProperty=a.nodeCategoryProperty)};function lr(a,b){b=b.modelData;Ga(b)&&(a.Bm(b),a.modelData=b)}
t.pw=function(){var a=this.modelData,b=!1,c;for(c in a)if(!mr(c,a[c])){b=!0;break}a="";b&&(a=',\n  "modelData": '+nr(this,this.modelData));return a+',\n  "nodeDataArray": '+or(this,this.nodeDataArray,!0)};t.Kv=function(a){lr(this,a);a=a.nodeDataArray;Ha(a)&&(this.Bm(a),this.nodeDataArray=a)};
function ir(a,b){function c(a,b){if(b=b.part)if(b=b.data,a!==b){var c=d.get(a);null===c?(c=new I,c.add(b),d.add(a,c)):c.add(b)}}var d=a.Xh;null===d&&(d=new yb,b.changes.each(function(a){if(null!==a.diagram){var b=a.change;if(b===se)(a=a.object.panel)&&(b=a.data)&&c(b,a);else if(b===ue||b===ve)a=a.object,(b=a.itemArray)&&c(b,a)}}),a.Xh=d)}function jr(a,b){for(var c=new I,d=0;d<a.nodeDataArray.length;d++){var e=a.nodeDataArray[d];pr(a,b,e,e,c)}return c}
function pr(a,b,c,d,e){if(Array.isArray(c))for(var f=0;f<c.length;f++){var g=c[f];if(g===b)return e.add(d),!0;if(pr(a,b,g,d,e))return!0}else if(Ga(c)&&Object.getPrototypeOf(c)===Object.prototype)for(f in c){g=c[f];if(g===b)return e.add(d),!0;if(pr(a,b,g,d,e))return!0}return!1}
t.nw=function(a,b){var c=this,d=!1,e=new I,f=new I,g=new I,h=this.Xh;a.changes.each(function(a){a.model===c&&("nodeDataArray"===a.modelChange?a.change===ue?e.add(a.newValue):a.change===ve&&g.add(a.oldValue):c.ab(a.object)?f.add(a.object):a.change!==se||c.modelData!==a.object&&"modelData"!==a.propertyName?null!==a.object&&(h&&h.contains(a.object)?h.get(a.object).each(function(a){c.ab(a)&&f.add(a)}):a.object instanceof Y||c.aj()&&c.Ec(a.object)||jr(c,a.object).each(function(a){f.add(a)})):d=!0)});var k=
this.El;k.clear();e.each(function(a){k.add(c.va(a));b||f.add(a)});var l=this.Gl;l.clear();g.each(function(a){l.add(c.va(a));b&&f.add(a)});a="";d&&(a+=',\n  "modelData": '+nr(this,this.modelData));0<k.count&&(a+=(b?this.Mw:this.Kw)+or(this,k.Fa(),!0));0<f.count&&(a+=this.Yy+or(this,f.Fa(),!0));0<l.count&&(a+=(b?this.Kw:this.Mw)+or(this,l.Fa(),!0));l.clear();k.clear();return a};
t.zq=function(a){(void 0!==a.name&&a.name!==this.name||void 0!==a.dataFormat&&a.dataFormat!==this.dataFormat||void 0!==a.isReadOnly&&a.isReadOnly!==this.isReadOnly||void 0!==a.nodeKeyProperty&&a.nodeKeyProperty!==this.nodeKeyProperty||void 0!==a.copiesArrays&&a.copiesArrays!==this.copiesArrays||void 0!==a.copiesArrayObjects&&a.copiesArrayObjects!==this.copiesArrayObjects||void 0!==a.copiesKey&&a.copiesKey!==this.copiesKey||void 0!==a.nodeCategoryProperty&&a.nodeCategoryProperty!==this.nodeCategoryProperty)&&
v("applyIncrementalJson cannot change Model properties");lr(this,a);var b=a.insertedNodeKeys,c=a.modifiedNodeData,d=new yb;if(Array.isArray(c))for(var e=0;e<c.length;e++){var f=c[e],g=this.va(f);void 0!==g&&null!==g&&d.set(g,f)}if(Array.isArray(b))for(e=b.length,f=0;f<e;f++){g=b[f];var h=this.cc(g);null===h&&(h=(h=d.get(g))?h:this.copyNodeData({}),this.Im(h,g),this.Ef(h))}if(Array.isArray(c))for(b=c.length,d=0;d<b;d++)if(e=c[d],f=this.va(e),f=this.cc(f),null!==f){for(var k in e)"__gohashid"===k||
k===this.nodeKeyProperty||this.nk()&&k===this.nodeIsGroupProperty||this.setDataProperty(f,k,e[k]);this.Jm(e,f)}a=a.removedNodeKeys;if(Array.isArray(a))for(c=a.length,k=0;k<c;k++)b=this.cc(a[k]),null!==b&&this.Am(b)};
t.Ry=function(a,b){w(a,re,Y,"toIncrementalJson:e");a.change!==te&&v("Model.toIncrementalJson argument is not a Transaction ChangedEvent:"+a.toString());var c=a.object;if(!(a.isTransactionFinished&&c instanceof we))return'{ "incremental": 0 }';void 0===b&&(b=qr(this,this));ir(this,c);a=this.nw(c,"FinishedUndo"===a.propertyName);this.Xh=null;return"2"===b?'{ "incremental": 2'+a+"}":'{ "class": '+this.quote(b)+', "incremental": 1'+this.Qm()+a+"}"};t.nB=function(a,b){return this.Ry(a,b)};
t.Iq=function(a){void 0===a&&(a=qr(this,this));return'{ "class": '+this.quote(a)+this.Qm()+this.pw()+"}"};t.toJSON=function(a){return this.Iq(a)};t.Lx=function(a){var b=null;if("string"===typeof a)try{b=sa.JSON.parse(a)}catch(d){G&&Fa("JSON.parse error: "+d.toString())}else"object"===typeof a?b=a:v("Unable to modify a Model from: "+a);var c=b.incremental;"number"!==typeof c&&v("Unable to apply non-incremental changes to Model: "+a);0!==c&&(this.Ea("applyIncrementalJson"),this.zq(b),this.cb("applyIncrementalJson"))};
t.wz=function(a){return this.Lx(a)};Y.constructGraphLinksModel=function(){G&&v("Unable to construct a Model. Provided JSON requires GraphLinksModel, which is not loaded.");return new Y};t=Y.prototype;
t.Bm=function(a){if(Ha(a))for(var b=a.length,c=0;c<b;c++){var d=a[c];if(Ga(d)){var e=c;d=this.Bm(d);Array.isArray(a)?a[e]=d:v("Cannot replace an object in an HTMLCollection or NodeList at "+e)}}else if(Ga(a)){for(b in a)if(c=a[b],Ga(c)&&(c=this.Bm(c),a[b]=c,"points"===b&&Array.isArray(c))){e=0===c.length%2;for(d=0;d<c.length;d++)if("number"!==typeof c[d]){e=!1;break}if(e){e=new H;for(d=0;d<c.length/2;d++)e.add(new K(c[2*d],c[2*d+1]));e.freeze();a[b]=e}}return rr(a)}return a};
t.Rm=function(a){return void 0===a?"undefined":null===a?"null":!0===a?"true":!1===a?"false":"string"===typeof a?this.quote(a):"number"===typeof a?Infinity===a?"9e9999":-Infinity===a?"-9e9999":isNaN(a)?'{"class":"NaN"}':a.toString():a instanceof Date?'{"class":"Date", "value":"'+a.toJSON()+'"}':a instanceof Number?this.Rm(a.valueOf()):Ha(a)?or(this,a):Ga(a)?nr(this,a):"function"===typeof a?"null":a.toString()};
function or(a,b,c){void 0===c&&(c=!1);var d=b.length;if(0>=d)return"[]";var e=new eb;e.add("[");c&&1<d&&e.add("\n");for(var f=0;f<d;f++){var g=b[f];void 0!==g&&(0<f&&(e.add(","),c&&e.add("\n")),e.add(a.Rm(g)))}c&&1<d&&e.add("\n");e.add("]");return e.toString()}function mr(a,b){return void 0===b||"__gohashid"===a||"_"===a[0]||"function"===typeof b?!0:!1}function sr(a){return isNaN(a)?"NaN":Infinity===a?"9e9999":-Infinity===a?"-9e9999":a}
function nr(a,b){var c=b;if(c instanceof K)b={"class":"go.Point",x:sr(c.x),y:sr(c.y)};else if(c instanceof Hb)b={"class":"go.Size",width:sr(c.width),height:sr(c.height)};else if(c instanceof M)b={"class":"go.Rect",x:sr(c.x),y:sr(c.y),width:sr(c.width),height:sr(c.height)};else if(c instanceof fc)b={"class":"go.Margin",top:sr(c.top),right:sr(c.right),bottom:sr(c.bottom),left:sr(c.left)};else if(c instanceof Ib)c.fb()?b={"class":"go.Spot",x:sr(c.x),y:sr(c.y),offsetX:sr(c.offsetX),offsetY:sr(c.offsetY)}:
b={"class":"go.Spot","enum":c.toString()};else if(c instanceof vl){b={"class":"go.Brush",type:c.type.name};if(c.type===Cl)b.color=c.color;else if(c.type===Fl||c.type===wl)b.start=c.start,b.end=c.end,c.type===wl&&(0!==c.startRadius&&(b.startRadius=sr(c.startRadius)),isNaN(c.endRadius)||(b.endRadius=sr(c.endRadius)));if(null!==c.colorStops){var d={};for(c=c.colorStops.iterator;c.next();)d[c.key]=c.value;b.colorStops=d}}else if(c instanceof N)b={"class":"go.Geometry",type:c.type.name},0!==c.startX&&
(b.startX=sr(c.startX)),0!==c.startY&&(b.startY=sr(c.startY)),0!==c.endX&&(b.endX=sr(c.endX)),0!==c.endY&&(b.endY=sr(c.endY)),c.spot1.B(Cc)||(b.spot1=c.spot1),c.spot2.B(Nc)||(b.spot2=c.spot2),c.type===N.o&&(b.path=N.Da(c));else if(c instanceof F)b={"class":"go.EnumValue",classType:qr(a,c.classType),name:c.name};else if(G&&null!==ur(qr(a,c)))return Fa("ERROR: trying to convert a GraphObject or Diagram or Model or Tool or Layout or UndoManager or other unknown data into JSON text: "+c.toString()),"{}";
d="{";c=!0;for(var e in b){var f=yn(b,e);if(!mr(e,f))if(c?c=!1:d+=",",d+=a.quote(e)+":","points"===e&&f instanceof H){var g="[";for(f=f.iterator;f.next();){var h=f.value;1<g.length&&(g+=",");g+=a.Rm(h.x);g+=",";g+=a.Rm(h.y)}g+="]";d+=g}else d+=a.Rm(f)}return d+"}"}function vr(a){return"number"===typeof a?a:"NaN"===a?NaN:"9e9999"===a?Infinity:"-9e9999"===a?-Infinity:parseFloat(a)}
function rr(a){if("object"!==typeof a)return a;var b=a["class"]||"";if("NaN"===b)return NaN;if("Date"===b)return new Date(a.value);if(0!==b.indexOf("go."))return a;b=b.substr(3);var c=a;if("Point"===b)c=new K(vr(a.x),vr(a.y));else if("Size"===b)c=new Hb(vr(a.width),vr(a.height));else if("Rect"===b)c=new M(vr(a.x),vr(a.y),vr(a.width),vr(a.height));else if("Margin"===b)c=new fc(vr(a.top),vr(a.right),vr(a.bottom),vr(a.left));else if("Spot"===b)"string"===typeof a["enum"]?c=td(a["enum"]):c=new Ib(vr(a.x),
vr(a.y),vr(a.offsetX),vr(a.offsetY));else if("Brush"===b){if(c=new vl,c.type=cb(vl,a.type),"string"===typeof a.color&&(c.color=a.color),a.start instanceof Ib&&(c.start=a.start),a.end instanceof Ib&&(c.end=a.end),"number"===typeof a.startRadius&&(c.startRadius=vr(a.startRadius)),"number"===typeof a.endRadius&&(c.endRadius=vr(a.endRadius)),a=a.colorStops,Ga(a))for(var d in a)c.addColorStop(parseFloat(d),a[d])}else"Geometry"===b?(c=null,"string"===typeof a.path?c=N.parse(a.path):c=new N,c.type=cb(N,
a.type),"number"===typeof a.startX&&(c.startX=vr(a.startX)),"number"===typeof a.startY&&(c.startY=vr(a.startY)),"number"===typeof a.endX&&(c.endX=vr(a.endX)),"number"===typeof a.endY&&(c.endY=vr(a.endY)),a.spot1 instanceof Ib&&(c.spot1=a.spot1),a.spot2 instanceof Ib&&(c.spot2=a.spot2)):"EnumValue"===b&&(d=a.classType,0===d.indexOf("go.")&&(d=d.substr(3)),d=ur(d),"function"===typeof d&&(c=cb(d,a.name)));return c}t.Jh=function(a){A(a,"function",Y,"addChangedListener:listener");this.au.add(a);return this};
t.Ak=function(a){A(a,"function",Y,"removeChangedListener:listener");this.au.remove(a)};t.ws=function(a){this.skipsUndoManager||this.undoManager.mv(a);for(var b=this.au,c=b.length,d=0;d<c;d++)b.M(d)(a)};t.bb=function(a,b,c,d,e,f,g){wr(this,"",a,b,c,d,e,f,g)};t.g=function(a,b,c,d,e){wr(this,"",se,a,this,b,c,d,e)};t.$s=function(a,b,c,d,e,f){wr(this,"",se,b,a,c,d,e,f)};
function wr(a,b,c,d,e,f,g,h,k){void 0===h&&(h=null);void 0===k&&(k=null);var l=new re;l.model=a;l.change=c;l.modelChange=b;l.propertyName=d;l.object=e;l.oldValue=f;l.oldParam=h;l.newValue=g;l.newParam=k;a.ws(l)}
Y.prototype.changeState=function(a,b){if(null!==a&&a.model===this)if(a.change===se){var c=a.object,d=a.propertyName,e=a.K(b);d===this.nodeKeyProperty&&this.ab(c)&&(b=a.K(!b),void 0!==b&&this.jb.remove(b),void 0!==e&&this.jb.add(e,c));Vj(c,d,e)}else a.change===ue?(c=a.newParam,"nodeDataArray"===a.modelChange?(a=a.newValue,Ga(a)&&"number"===typeof c&&(d=this.va(a),b?(this.Bc[c]===a&&La(this.Bc,c),void 0!==d&&this.jb.remove(d)):(this.Bc[c]!==a&&Ka(this.Bc,c,a),void 0!==d&&this.jb.add(d,a)))):""===a.modelChange?
((d=a.object)&&!Ha(d)&&a.propertyName&&(d=yn(a.object,a.propertyName)),Ha(d)&&"number"===typeof c&&(a=a.newValue,b?La(d,c):Ka(d,c,a))):v("unknown ChangedEvent.Insert modelChange: "+a.toString())):a.change===ve?(c=a.oldParam,"nodeDataArray"===a.modelChange?(a=a.oldValue,Ga(a)&&"number"===typeof c&&(d=this.va(a),b?(this.Bc[c]!==a&&Ka(this.Bc,c,a),void 0!==d&&this.jb.add(d,a)):(this.Bc[c]===a&&La(this.Bc,c),void 0!==d&&this.jb.remove(d)))):""===a.modelChange?((d=a.object)&&!Ha(d)&&a.propertyName&&(d=
yn(a.object,a.propertyName)),Ha(d)&&"number"===typeof c&&(a=a.oldValue,b?Ka(d,c,a):La(d,c))):v("unknown ChangedEvent.Remove modelChange: "+a.toString())):a.change!==te&&v("unknown ChangedEvent: "+a.toString())};Y.prototype.Ea=function(a){return this.undoManager.Ea(a)};Y.prototype.cb=function(a){return this.undoManager.cb(a)};Y.prototype.Tf=function(){return this.undoManager.Tf()};
Y.prototype.commit=function(a,b){void 0===b&&(b="");var c=this.skipsUndoManager;null===b&&(this.skipsUndoManager=!0,b="");this.undoManager.Ea(b);var d=!1;try{a(this),d=!0}finally{d?this.undoManager.cb(b):this.undoManager.Tf(),this.skipsUndoManager=c}};t=Y.prototype;t.Ka=function(a,b){void 0===b&&(b="");wr(this,"SourceChanged",te,b,a,null,null)};function xr(a,b,c){"string"!==typeof a&&"function"!==typeof a&&za(a,"string or function",b,c)}
t.va=function(a){if(null!==a){var b=this.zi;if(""!==b&&(b=yn(a,b),void 0!==b)){if(Zq(b))return b;v("Key value for node data "+a+" is not a number or a string: "+b)}}};
t.Im=function(a,b){void 0!==b&&null!==b&&Zq(b)||za(b,"number or string",Y,"setKeyForNodeData:key");if(null!==a){var c=this.zi;if(""!==c)if(this.ab(a)){var d=yn(a,c);d!==b&&null===this.cc(b)&&(Vj(a,c,b),void 0!==d&&this.jb.remove(d),this.jb.add(b,a),wr(this,"nodeKey",se,c,a,d,b),"string"===typeof c&&this.Ka(a,c),this.Eq(d,b))}else Vj(a,c,b)}};function Zq(a){return"number"===typeof a||"string"===typeof a}t.ab=function(a){var b=this.va(a);return void 0===b?!1:this.jb.K(b)===a};
t.cc=function(a){null===a&&v("Model.findNodeDataForKey:key must not be null");return void 0!==a&&Zq(a)?this.jb.K(a):null};
t.xv=function(a){if(null!==a){var b=this.zi;if(""!==b){var c=this.va(a);if(void 0===c||this.jb.contains(c)){var d=this.yl;if(null!==d&&(c=d(this,a),void 0!==c&&null!==c&&!this.jb.contains(c))){Vj(a,b,c);return}if("string"===typeof c){for(d=2;this.jb.contains(c+d);)d++;Vj(a,b,c+d)}else if(void 0===c||"number"===typeof c){for(c=-this.jb.count-1;this.jb.contains(c);)c--;Vj(a,b,c)}else G&&v("Model.getKeyForNodeData returned something other than a string or a number: "+c)}}}};
t.Ef=function(a){null!==a&&(nb(a),this.ab(a)||Rq(this,a,!0))};function Rq(a,b,c){var d=a.va(b);if(void 0===d||a.jb.K(d)!==b)a.xv(b),d=a.va(b),void 0===d&&v("Model.makeNodeDataKeyUnique failed on "+b+".  Data not added to Model."),a.jb.add(d,b),d=null,c&&(d=a.Bc.length,Ka(a.Bc,d,b)),wr(a,"nodeDataArray",ue,"nodeDataArray",a,null,b,null,d),a.Dm(b),a.Cm(b)}t.rz=function(a){if(Ha(a))for(var b=a.length,c=0;c<b;c++)this.Ef(a[c]);else for(a=a.iterator;a.next();)this.Ef(a.value)};
t.Am=function(a){null!==a&&Qq(this,a,!0)};function Qq(a,b,c){var d=a.va(b);void 0!==d&&a.jb.remove(d);d=null;if(c){a:if(c=a.Bc,Array.isArray(c))d=c.indexOf(b);else{d=c.length;for(var e=0;e<d;e++)if(c[e]===b){d=e;break a}d=-1}if(0>d)return;La(a.Bc,d)}wr(a,"nodeDataArray",ve,"nodeDataArray",a,b,null,d,null);a.Lq(b)}t.bB=function(a){if(Ha(a))for(var b=a.length,c=0;c<b;c++)this.Am(a[c]);else for(a=a.iterator;a.next();)this.Am(a.value)};
t.PA=function(a){if(a!==this.nodeDataArray&&Ha(a)){var b=this.Gl;b.clear();b.addAll(this.jb.iteratorKeys);var c=this.El;c.clear();for(var d=a.length,e=0;e<d;e++){var f=a[e],g=this.va(f);if(void 0!==g){c.add(g);var h=this.cc(g);h!==f&&(null!==h?(this.Zp(h,f),this.Jm(f,h)):(f=this.cloneDeep(f),this.Im(f,g),this.Ef(f)))}else g=this.cloneDeep(f),this.Ef(g),c.add(this.va(g))}for(a=b.iterator;a.next();)d=a.value,c.contains(d)||(d=this.cc(d))&&this.Am(d);b.clear();c.clear()}};
t.Eq=function(a,b){void 0!==b&&(a=br(this,a),a instanceof I&&this.ag.add(b,a))};t.hw=function(){};t.Dm=function(){};t.Cm=function(){};t.Lq=function(){};function dr(a,b,c){if(void 0!==b){var d=a.ag.K(b);null===d&&(d=new I,a.ag.add(b,d));d.add(c)}}function cr(a,b,c){if(void 0!==b){var d=a.ag.K(b);d instanceof I&&(void 0===c||null===c?a.ag.remove(b):(d.remove(c),0===d.count&&a.ag.remove(b)))}}function br(a,b){if(void 0===b)return null;a=a.ag.K(b);return a instanceof I?a:null}
t.Ez=function(a){void 0===a?this.ag.clear():this.ag.remove(a)};Y.prototype.copyNodeData=function(a){if(null===a)return null;var b=this.Uk;a=null!==b?b(a,this):yr(this,a,!0);Ga(a)&&ab(a);return a};
function yr(a,b,c){if(a.copiesArrays&&Array.isArray(b)){var d=[];for(c=0;c<b.length;c++){var e=yr(a,b[c],a.copiesArrayObjects);d.push(e)}ab(d);return d}if(c&&Ga(b)){c=(c=b.constructor)?new c:{};e=a.copiesKey||"string"!==typeof a.nodeKeyProperty?null:a.nodeKeyProperty;for(d in b)if("__gohashid"===d)c.__gohashid=void 0;else if(d===e)c[e]=void 0;else{var f=yn(b,d);var g=qr(a,f);"GraphObject"===g||"Diagram"===g||"Layer"===g||"RowColumnDefinition"===g||"AnimationManager"===g||"Tool"===g||"CommandHandler"===
g||"Layout"===g||"InputEvent"===g||"DiagramEvent"===g?(G&&"_"!==d[0]&&Fa('Warning: found GraphObject or Diagram reference when copying model data on property "'+d+'" of data object: '+b.toString()+"  \nModel data should not have any references to a Diagram or any part of a diagram, such as: "+f.toString()),g=!0):g=f instanceof Y||f instanceof xe||f instanceof we||f instanceof re?!0:!1;g?Vj(c,d,f):(f=yr(a,f,!1),Vj(c,d,f))}ab(c);return c}return b instanceof K?b.copy():b instanceof Hb?b.copy():b instanceof
M?b.copy():b instanceof Ib?b.copy():b instanceof fc?b.copy():b}
Y.prototype.setDataProperty=function(a,b,c){G&&(A(a,"object",Y,"setDataProperty:data"),A(b,"string",Y,"setDataProperty:propname"),""===b&&v("Model.setDataProperty: property name must not be an empty string when setting "+a+" to "+c));if(this.ab(a)){if(b===this.nodeKeyProperty){this.Im(a,c);return}if(b===this.nodeCategoryProperty){this.Hm(a,c);return}}else!zr&&a instanceof O&&(zr=!0,Fa('Model.setDataProperty is modifying a GraphObject, "'+a.toString()+'"'),Fa("  Is that really your intent?"));var d=
yn(a,b);d!==c&&(Vj(a,b,c),this.$s(a,b,d,c))};t=Y.prototype;t.set=function(a,b,c){this.setDataProperty(a,b,c)};t.Zp=function(a,b){if(b){var c=this.ab(a),d;for(d in b)"__gohashid"===d||c&&d===this.nodeKeyProperty||this.setDataProperty(a,d,b[d])}};t.nz=function(a,b){this.Ks(a,-1,b)};
t.Ks=function(a,b,c){G&&(Ia(a,Y,"insertArrayItem:arr"),E(b,Y,"insertArrayItem:idx"),a===this.Bc&&v("Model.insertArrayItem or Model.addArrayItem should not be called on the Model.nodeDataArray"));0>b&&(b=a.length);Ka(a,b,c);wr(this,"",ue,"",a,null,c,null,b)};
t.Nv=function(a,b){void 0===b&&(b=-1);G&&(Ia(a,Y,"removeArrayItem:arr"),E(b,Y,"removeArrayItem:idx"));a===this.Bc&&v("Model.removeArrayItem should not be called on the Model.nodeDataArray");-1===b&&(b=a.length-1);var c=a[b];La(a,b);wr(this,"",ve,"",a,c,null,b,null)};t.lq=function(a){if(null===a)return"";var b=this.Kj;if(""===b)return"";b=yn(a,b);if(void 0===b)return"";if("string"===typeof b)return b;v("getCategoryForNodeData found a non-string category for "+a+": "+b)};
t.Hm=function(a,b){A(b,"string",Y,"setCategoryForNodeData:cat");if(null!==a){var c=this.Kj;if(""!==c)if(this.ab(a)){var d=yn(a,c);void 0===d&&(d="");d!==b&&(Vj(a,c,b),wr(this,"nodeCategory",se,c,a,d,b))}else Vj(a,c,b)}};t.Jm=function(a,b){this.Hm(b,this.lq(a))};t.rm=function(){return!1};t.nk=function(){return!1};t.aj=function(){return!1};t.Qs=function(){return!1};t.Zi=function(){return!1};function xi(){return new Y}
function qr(a,b){if("function"===typeof b){if(b.className)return b.className;if(b.name)return b.name}else if("object"===typeof b&&null!==b&&b.constructor)return qr(a,b.constructor);return typeof b}function ur(a){return Ar[a]?Ar[a]:void 0!==sa.go&&sa.go[a]?sa.go[a]:null}function yn(a,b){if(!a||!b)return null;try{if("function"===typeof b)var c=b(a);else"function"===typeof a.getAttribute?(c=a.getAttribute(b),null===c&&(c=void 0)):c=a[b]}catch(d){G&&Fa("property get error: "+d.toString())}return c}
function Vj(a,b,c){if(a&&b)try{"function"===typeof b?b(a,c):"function"===typeof a.setAttribute?a.setAttribute(b,c):a[b]=c}catch(d){G&&Fa("property set error: "+d.toString())}}
na.Object.defineProperties(Y.prototype,{name:{configurable:!0,get:function(){return this.ta},set:function(a){var b=this.ta;b!==a&&(A(a,"string",Y,"name"),this.ta=a,this.g("name",b,a))}},dataFormat:{configurable:!0,get:function(){return this.xn},set:function(a){var b=this.xn;b!==a&&(A(a,"string",Y,"dataFormat"),this.xn=a,this.g("dataFormat",b,a))}},isReadOnly:{configurable:!0,get:function(){return this.dh},set:function(a){var b=this.dh;b!==a&&(A(a,"boolean",
Y,"isReadOnly"),this.dh=a,this.g("isReadOnly",b,a))}},modelData:{configurable:!0,get:function(){return this.j},set:function(a){var b=this.j;b!==a&&(A(a,"object",Y,"modelData"),this.j=a,this.g("modelData",b,a),this.Ka(a))}},undoManager:{configurable:!0,get:function(){return this.o},set:function(a){var b=this.o;b!==a&&(w(a,xe,Y,"undoManager"),null!==b&&b.Gy(this),this.o=a,null!==a&&a.Jx(this))}},skipsUndoManager:{configurable:!0,get:function(){return this.vh},
set:function(a){A(a,"boolean",Y,"skipsUndoManager");this.vh=a}},nodeKeyProperty:{configurable:!0,get:function(){return this.zi},set:function(a){var b=this.zi;b!==a&&(xr(a,Y,"nodeKeyProperty"),""===a&&v("Model.nodeKeyProperty may not be the empty string"),0<this.jb.count&&v("Cannot set Model.nodeKeyProperty when there is existing node data"),this.zi=a,this.g("nodeKeyProperty",b,a))}},makeUniqueKeyFunction:{configurable:!0,get:function(){return this.yl},set:function(a){var b=
this.yl;b!==a&&(null!==a&&A(a,"function",Y,"makeUniqueKeyFunction"),this.yl=a,this.g("makeUniqueKeyFunction",b,a))}},nodeDataArray:{configurable:!0,get:function(){return this.Bc},set:function(a){var b=this.Bc;if(b!==a){Ia(a,Y,"nodeDataArray");this.jb.clear();this.hw();for(var c=a.length,d=0;d<c;d++){var e=a[d];Ga(e)||v("Model.nodeDataArray must only contain Objects, not: "+e);nb(e)}this.Bc=a;d=new H;for(e=0;e<c;e++){var f=a[e],g=this.va(f);void 0===g?d.add(f):null!==this.jb.K(g)?d.add(f):
this.jb.add(g,f)}for(d=d.iterator;d.next();)e=d.value,this.xv(e),f=this.va(e),void 0!==f&&this.jb.add(f,e);wr(this,"nodeDataArray",se,"nodeDataArray",this,b,a);for(b=0;b<c;b++)d=a[b],this.Dm(d),this.Cm(d);Array.isArray(a)||(this.isReadOnly=!0)}}},copyNodeDataFunction:{configurable:!0,get:function(){return this.Uk},set:function(a){var b=this.Uk;b!==a&&(null!==a&&A(a,"function",Y,"copyNodeDataFunction"),this.Uk=a,this.g("copyNodeDataFunction",b,a))}},copiesArrays:{configurable:!0,
get:function(){return this.pn},set:function(a){var b=this.pn;b!==a&&(null!==a&&A(a,"boolean",Y,"copiesArrays"),this.pn=a,this.g("copiesArrays",b,a))}},copiesArrayObjects:{configurable:!0,get:function(){return this.on},set:function(a){var b=this.on;b!==a&&(null!==a&&A(a,"boolean",Y,"copiesArrayObjects"),this.on=a,this.g("copiesArrayObjects",b,a))}},copiesKey:{configurable:!0,get:function(){return this.rn},set:function(a){var b=this.rn;b!==a&&(null!==a&&A(a,"boolean",Y,"copiesKey"),
this.rn=a,this.g("copiesKey",b,a))}},afterCopyFunction:{configurable:!0,get:function(){return this.$m},set:function(a){var b=this.$m;b!==a&&(null!==a&&A(a,"function",Y,"afterCopyFunction"),this.$m=a,this.g("afterCopyFunction",b,a))}},nodeCategoryProperty:{configurable:!0,get:function(){return this.Kj},set:function(a){var b=this.Kj;b!==a&&(xr(a,Y,"nodeCategoryProperty"),this.Kj=a,this.g("nodeCategoryProperty",b,a))}},type:{configurable:!0,get:function(){return"Model"}}});
Y.prototype.setCategoryForNodeData=Y.prototype.Hm;Y.prototype.getCategoryForNodeData=Y.prototype.lq;Y.prototype.removeArrayItem=Y.prototype.Nv;Y.prototype.insertArrayItem=Y.prototype.Ks;Y.prototype.addArrayItem=Y.prototype.nz;Y.prototype.assignAllDataProperties=Y.prototype.Zp;Y.prototype.set=Y.prototype.set;Y.prototype.clearUnresolvedReferences=Y.prototype.Ez;Y.prototype.mergeNodeDataArray=Y.prototype.PA;Y.prototype.removeNodeDataCollection=Y.prototype.bB;Y.prototype.removeNodeData=Y.prototype.Am;
Y.prototype.addNodeDataCollection=Y.prototype.rz;Y.prototype.addNodeData=Y.prototype.Ef;Y.prototype.makeNodeDataKeyUnique=Y.prototype.xv;Y.prototype.findNodeDataForKey=Y.prototype.cc;Y.prototype.containsNodeData=Y.prototype.ab;Y.prototype.setKeyForNodeData=Y.prototype.Im;Y.prototype.getKeyForNodeData=Y.prototype.va;Y.prototype.updateTargetBindings=Y.prototype.Ka;Y.prototype.commit=Y.prototype.commit;Y.prototype.rollbackTransaction=Y.prototype.Tf;Y.prototype.commitTransaction=Y.prototype.cb;
Y.prototype.startTransaction=Y.prototype.Ea;Y.prototype.raiseDataChanged=Y.prototype.$s;Y.prototype.raiseChanged=Y.prototype.g;Y.prototype.raiseChangedEvent=Y.prototype.bb;Y.prototype.removeChangedListener=Y.prototype.Ak;Y.prototype.addChangedListener=Y.prototype.Jh;Y.prototype.writeJsonValue=Y.prototype.Rm;Y.prototype.replaceJsonObjects=Y.prototype.Bm;Y.prototype.applyIncrementalJSON=Y.prototype.wz;Y.prototype.applyIncrementalJson=Y.prototype.Lx;Y.prototype.toJSON=Y.prototype.toJSON;
Y.prototype.toJson=Y.prototype.Iq;Y.prototype.toIncrementalJSON=Y.prototype.nB;Y.prototype.toIncrementalJson=Y.prototype.Ry;Y.prototype.toIncrementalData=Y.prototype.mB;Y.prototype.clear=Y.prototype.clear;var zr=!1,Ar={};Y.className="Model";
Y.fromJSON=Y.fromJson=function(a,b){void 0===b&&(b=null);null!==b&&w(b,Y,Y,"fromJson:model");var c=null;if("string"===typeof a)try{c=sa.JSON.parse(a)}catch(f){G&&Fa("JSON.parse error: "+f.toString())}else"object"===typeof a?c=a:v("Unable to construct a Model from: "+a);if(null===b){a=null;var d=c["class"];if("string"===typeof d)try{var e=null;0===d.indexOf("go.")?(d=d.substr(3),e=ur(d)):(e=ur(d),null===e&&(e=sa[d]));"function"===typeof e&&(a=new e)}catch(f){}null===a||a instanceof Y?b=a:v("Unable to construct a Model of declared class: "+
c["class"])}null===b&&(b=Y.constructGraphLinksModel());b.Aq(c);b.Kv(c);return b};Y.safePropertyValue=yn;Y.safePropertySet=Vj;Ar.Brush=vl;Ar.ChangedEvent=re;Ar.Geometry=N;Ar.Margin=fc;Ar.Panel=X;Ar.Point=K;Ar.Rect=M;Ar.Size=Hb;Ar.Spot=Ib;Ar.Transaction=we;Ar.UndoManager=xe;
function Fi(a,b,c,d){ab(this);this.u=!1;void 0===a?a="":A(a,"string",Fi,"constructor:targetprop");void 0===b?b=a:A(b,"string",Fi,"constructor:sourceprop");void 0===c?c=null:null!==c&&A(c,"function",Fi,"constructor:conv");this.j=-1;this.vd=null;this.am=a;this.$l=this.Kp=0;this.gs=null;this.mo=!1;this.Tl=b;this.nn=c;void 0===d?(this.Bl=Br,this.Nk=null):(this.Bl=qn,this.Nk=d);this.Rt=new I}
Fi.prototype.copy=function(){var a=new Fi;a.am=this.am;a.Kp=this.Kp;a.$l=this.$l;a.gs=this.gs;a.mo=this.mo;a.Tl=this.Tl;a.nn=this.nn;a.Bl=this.Bl;a.Nk=this.Nk;return a};t=Fi.prototype;t.mb=function(a){a.classType===Fi?this.mode=a:Ea(this,a)};t.toString=function(){return"Binding("+this.targetProperty+":"+this.sourceProperty+(-1!==this.ij?" "+this.ij:"")+" "+this.mode.name+")"};t.freeze=function(){this.u=!0;return this};t.ka=function(){this.u=!1;return this};
t.yy=function(a){void 0===a&&(a=null);null!==a&&A(a,"function",Fi,"makeTwoWay");this.mode=qn;this.backConverter=a;return this};t.xq=function(a){void 0===a&&(a="");G&&A(a,"string",Fi,"ofObject:srcname");this.sourceName=a;this.isToModel=!1;return this};t.SA=function(){this.sourceName=null;this.isToModel=!0;return this};function ol(a,b,c){a=a.sourceName;return null===a||""===a?b:"/"===a?c.part:"."===a?c:".."===a?c.panel:b.eb(a)}
t.iw=function(a,b,c){var d=this.Tl;if(void 0===c||""===d||d===c){c=this.am;var e=this.nn;if(null===e&&""===c)Fa("Binding error: target property is the empty string: "+this.toString());else{G&&"string"===typeof c&&("function"!==typeof a.setAttribute&&0<c.length&&"_"!==c[0]&&!Sa(a,c)?Fa("Binding error: undefined target property: "+c+" on "+a.toString()):"name"===c&&a instanceof O&&Fa("Binding error: cannot modify GraphObject.name on "+a.toString()));var f=b;""!==d&&(f=yn(b,d));if(void 0!==f)if(null===
e)""!==c&&Vj(a,c,f);else try{if(""!==c){var g=e(f,a);G&&void 0===g&&Fa('Binding warning: conversion function returned undefined when setting target property "'+c+'" on '+a.toString()+", function is: "+e);Vj(a,c,g)}else e(f,a)}catch(h){G&&Fa("Binding error: "+h.toString()+' setting target property "'+c+'" on '+a.toString()+" with conversion function: "+e)}}}};
t.Nq=function(a,b,c,d){if(this.Bl===qn){var e=this.am;if(void 0===c||e===c){c=this.Tl;var f=this.Nk,g=a;""!==e&&(g=yn(a,e));if(void 0!==g&&!this.Rt.contains(a))try{this.Rt.add(a);var h=null!==d?d.diagram:null,k=null!==h?h.model:null;if(null===f)if(""!==c)null!==k?(G&&k.nodeKeyProperty===c&&k.ab(b)&&Fa("Binding error: cannot have TwoWay Binding on node data key property: "+this.toString()),k.setDataProperty(b,c,g)):Vj(b,c,g);else{if(null!==k&&null!==d&&0<=d.itemIndex&&null!==d.panel&&Array.isArray(d.panel.itemArray)){var l=
d.itemIndex,m=d.panel.itemArray;k.Nv(m,l);k.Ks(m,l,g)}}else try{if(""!==c){var n=f(g,b,k);null!==k?(G&&(k.nodeKeyProperty===c&&k.ab(b)&&Fa("Binding error: cannot have TwoWay Binding on node data key property: "+this.toString()),void 0===n&&Fa('Binding warning: conversion function returned undefined when setting source property "'+c+'" on '+b.toString()+", function is: "+f)),k.setDataProperty(b,c,n)):Vj(b,c,n)}else{var p=f(g,b,k);if(void 0!==p&&null!==k&&null!==d&&0<=d.itemIndex&&null!==d.panel&&Array.isArray(d.panel.itemArray)){var r=
d.itemIndex,q=d.panel.itemArray;k.Nv(q,r);k.Ks(q,r,p)}}}catch(u){G&&Fa("Binding error: "+u.toString()+' setting source property "'+c+'" on '+b.toString()+" with conversion function: "+f)}}finally{this.Rt.remove(a)}}}};
na.Object.defineProperties(Fi.prototype,{ij:{configurable:!0,get:function(){return this.j},set:function(a){this.u&&xa(this);A(a,"number",Fi,"targetId");this.j=a}},targetProperty:{configurable:!0,get:function(){return this.am},set:function(a){this.u&&xa(this);A(a,"string",Fi,"targetProperty");this.am=a}},sourceName:{configurable:!0,get:function(){return this.gs},set:function(a){this.u&&xa(this);null!==a&&A(a,"string",Fi,"sourceName");this.gs=a;null!==a&&(this.mo=
!1)}},isToModel:{configurable:!0,get:function(){return this.mo},set:function(a){this.u&&xa(this);A(a,"boolean",Fi,"isToModel");this.mo=a}},sourceProperty:{configurable:!0,get:function(){return this.Tl},set:function(a){this.u&&xa(this);A(a,"string",Fi,"sourceProperty");this.Tl=a}},converter:{configurable:!0,get:function(){return this.nn},set:function(a){this.u&&xa(this);null!==a&&A(a,"function",Fi,"converter");this.nn=a}},backConverter:{configurable:!0,
get:function(){return this.Nk},set:function(a){this.u&&xa(this);null!==a&&A(a,"function",Fi,"backConverter");this.Nk=a}},mode:{configurable:!0,get:function(){return this.Bl},set:function(a){this.u&&xa(this);db(a,Fi,Fi,"mode");this.Bl=a}}});Fi.prototype.updateSource=Fi.prototype.Nq;Fi.prototype.updateTarget=Fi.prototype.iw;Fi.prototype.ofModel=Fi.prototype.SA;Fi.prototype.ofObject=Fi.prototype.xq;Fi.prototype.makeTwoWay=Fi.prototype.yy;
var Rk="Binding",Br=new F(Fi,"OneWay",1),qn=new F(Fi,"TwoWay",2);Fi.className="Binding";Fi.parseEnum=function(a,b){A(a,"function",Fi,"parseEnum:ctor");db(b,a,Fi,"parseEnum:defval");return function(c){c=cb(a,c);return null===c?b:c}};Fi.toString=Ra;Fi.OneWay=Br;Fi.TwoWay=qn;
function Cr(a,b,c){Y.call(this);this.Jw=',\n  "insertedLinkKeys": ';this.Xy=',\n  "modifiedLinkData": ';this.Lw=',\n  "removedLinkKeys": ';this.ed=[];this.gg=new I;this.pb=new yb;this.ti="";this.nj=this.Tk=this.zl=null;this.nf="from";this.pf="to";this.Gj=this.Fj="";this.Ej="category";this.ie="";this.Fl="isGroup";this.Le="group";this.qn=!1;void 0!==b&&(this.linkDataArray=b);void 0!==a&&(Ha(a)?this.nodeDataArray=a:Object.assign(this,a));c&&Object.assign(this,c)}ma(Cr,Y);
Cr.constructGraphLinksModel=Y.constructGraphLinksModel;Cr.prototype.cloneProtected=function(a){Y.prototype.cloneProtected.call(this,a);a.ti=this.ti;a.zl=this.zl;a.Tk=this.Tk;a.nf=this.nf;a.pf=this.pf;a.Fj=this.Fj;a.Gj=this.Gj;a.Ej=this.Ej;a.ie=this.ie;a.Fl=this.Fl;a.Le=this.Le;a.qn=this.qn};t=Cr.prototype;t.clear=function(){Y.prototype.clear.call(this);this.ed=[];this.pb.clear();this.gg.clear()};
t.toString=function(a){void 0===a&&(a=0);if(2<=a)return this.Iq();var b=(""!==this.name?this.name:"")+" GraphLinksModel";if(0<a){b+="\n node data:";a=this.nodeDataArray;var c=a.length,d;for(d=0;d<c;d++){var e=a[d];b+=" "+this.va(e)+":"+Ra(e)}b+="\n link data:";a=this.linkDataArray;c=a.length;for(d=0;d<c;d++)e=a[d],b+=" "+Xq(this,e,!0)+"--\x3e"+Xq(this,e,!1)}return b};
t.ow=function(a,b){""===this.linkKeyProperty&&v("GraphLinksModel.linkKeyProperty must not be an empty string for .toIncrementalData() to succeed.");var c=Y.prototype.ow.call(this,a,b),d=this,e=new I,f=new I,g=new I,h=this.Xh;a.changes.each(function(a){a.model===d&&("linkDataArray"===a.modelChange?a.change===ue?e.add(a.newValue):a.change===ve&&g.add(a.oldValue):d.Ec(a.object)?f.add(a.object):null!==a.object&&(null!==a.object&&h&&h.contains(a.object)?h.get(a.object).each(function(a){d.Ec(a)&&f.add(a)}):
a.object instanceof Y||d.ab(a.object)||Dr(d,a.object).each(function(a){f.add(a)})))});var k=this.El;k.clear();e.each(function(a){k.add(d.vc(a));b||f.add(a)});var l=this.Gl;l.clear();g.each(function(a){l.add(d.vc(a));b&&f.add(a)});a=d.cloneDeep(f.Fa());0<k.count&&(null===c&&(c={}),b?c.removedLinkKeys=k.Fa():c.insertedLinkKeys=k.Fa());0<a.length&&(null===c&&(c={}),c.modifiedLinkData=a);0<l.count&&(null===c&&(c={}),b?c.insertedLinkKeys=l.Fa():c.removedLinkKeys=l.Fa());l.clear();k.clear();return c};
t.Qm=function(){var a=Y.prototype.Qm.call(this),b="";"category"!==this.linkCategoryProperty&&"string"===typeof this.linkCategoryProperty&&(b+=',\n  "linkCategoryProperty": '+this.quote(this.linkCategoryProperty));""!==this.linkKeyProperty&&"string"===typeof this.linkKeyProperty&&(b+=',\n  "linkKeyProperty": '+this.quote(this.linkKeyProperty));"from"!==this.linkFromKeyProperty&&"string"===typeof this.linkFromKeyProperty&&(b+=',\n  "linkFromKeyProperty": '+this.quote(this.linkFromKeyProperty));"to"!==
this.linkToKeyProperty&&"string"===typeof this.linkToKeyProperty&&(b+=',\n  "linkToKeyProperty": '+this.quote(this.linkToKeyProperty));""!==this.linkFromPortIdProperty&&"string"===typeof this.linkFromPortIdProperty&&(b+=',\n  "linkFromPortIdProperty": '+this.quote(this.linkFromPortIdProperty));""!==this.linkToPortIdProperty&&"string"===typeof this.linkToPortIdProperty&&(b+=',\n  "linkToPortIdProperty": '+this.quote(this.linkToPortIdProperty));""!==this.linkLabelKeysProperty&&"string"===typeof this.linkLabelKeysProperty&&
(b+=',\n  "linkLabelKeysProperty": '+this.quote(this.linkLabelKeysProperty));"isGroup"!==this.nodeIsGroupProperty&&"string"===typeof this.nodeIsGroupProperty&&(b+=',\n  "nodeIsGroupProperty": '+this.quote(this.nodeIsGroupProperty));"group"!==this.nodeGroupKeyProperty&&"string"===typeof this.nodeGroupKeyProperty&&(b+=',\n  "nodeGroupKeyProperty": '+this.quote(this.nodeGroupKeyProperty));return a+b};
t.Aq=function(a){Y.prototype.Aq.call(this,a);a.linkKeyProperty&&(this.linkKeyProperty=a.linkKeyProperty);a.linkFromKeyProperty&&(this.linkFromKeyProperty=a.linkFromKeyProperty);a.linkToKeyProperty&&(this.linkToKeyProperty=a.linkToKeyProperty);a.linkFromPortIdProperty&&(this.linkFromPortIdProperty=a.linkFromPortIdProperty);a.linkToPortIdProperty&&(this.linkToPortIdProperty=a.linkToPortIdProperty);a.linkCategoryProperty&&(this.linkCategoryProperty=a.linkCategoryProperty);a.linkLabelKeysProperty&&(this.linkLabelKeysProperty=
a.linkLabelKeysProperty);a.nodeIsGroupProperty&&(this.nodeIsGroupProperty=a.nodeIsGroupProperty);a.nodeGroupKeyProperty&&(this.nodeGroupKeyProperty=a.nodeGroupKeyProperty)};t.pw=function(){var a=Y.prototype.pw.call(this),b=',\n  "linkDataArray": '+or(this,this.linkDataArray,!0);return a+b};t.Kv=function(a){Y.prototype.Kv.call(this,a);a=a.linkDataArray;Array.isArray(a)&&(this.Bm(a),this.linkDataArray=a)};
function Dr(a,b){for(var c=new I,d=0;d<a.linkDataArray.length;d++){var e=a.linkDataArray[d];pr(a,b,e,e,c)}return c}
t.nw=function(a,b){""===this.linkKeyProperty&&v("GraphLinksModel.linkKeyProperty must not be an empty string for .toIncrementalJson() to succeed.");var c=Y.prototype.nw.call(this,a,b),d=this,e=new I,f=new I,g=new I,h=this.Xh;a.changes.each(function(a){a.model===d&&("linkDataArray"===a.modelChange?a.change===ue?e.add(a.newValue):a.change===ve&&g.add(a.oldValue):d.Ec(a.object)?f.add(a.object):null!==a.object&&(null!==a.object&&h&&h.contains(a.object)?h.get(a.object).each(function(a){d.Ec(a)&&f.add(a)}):
a.object instanceof Y||d.ab(a.object)||Dr(d,a.object).each(function(a){f.add(a)})))});var k=this.El;k.clear();e.each(function(a){k.add(d.vc(a));b||f.add(a)});var l=this.Gl;l.clear();g.each(function(a){l.add(d.vc(a));b&&f.add(a)});a=c;0<k.count&&(a+=(b?this.Lw:this.Jw)+or(this,k.Fa(),!0));0<f.count&&(a+=this.Xy+or(this,f.Fa(),!0));0<l.count&&(a+=(b?this.Jw:this.Lw)+or(this,l.Fa(),!0));l.clear();k.clear();return a};
t.zq=function(a){(void 0!==a.linkCategoryProperty&&a.linkCategoryProperty!==this.linkCategoryProperty||void 0!==a.linkKeyProperty&&a.linkKeyProperty!==this.linkKeyProperty||void 0!==a.linkFromKeyProperty&&a.linkFromKeyProperty!==this.linkFromKeyProperty||void 0!==a.linkToKeyProperty&&a.linkToKeyProperty!==this.linkToKeyProperty||void 0!==a.linkFromPortIdProperty&&a.linkFromPortIdProperty!==this.linkFromPortIdProperty||void 0!==a.linkToPortIdProperty&&a.linkToPortIdProperty!==this.linkToPortIdProperty||
void 0!==a.linkLabelKeysProperty&&a.linkLabelKeysProperty!==this.linkLabelKeysProperty||void 0!==a.nodeIsGroupProperty&&a.nodeIsGroupProperty!==this.nodeIsGroupProperty||void 0!==a.nodeGroupKeyProperty&&a.nodeGroupKeyProperty!==this.nodeGroupKeyProperty)&&v("applyIncrementalJson cannot change Model properties");Y.prototype.zq.call(this,a);var b=a.insertedLinkKeys;if(Array.isArray(b))for(var c=b.length,d=0;d<c;d++){var e=b[d],f=this.Oh(e);null===f&&(f=this.eq({}),this.dt(f,e),this.Mi(f))}b=a.modifiedLinkData;
if(Array.isArray(b))for(c=b.length,d=0;d<c;d++)if(e=b[d],f=this.vc(e),f=this.Oh(f),null!==f){for(var g in e)"__gohashid"!==g&&g!==this.linkKeyProperty&&this.setDataProperty(f,g,e[g]);Er(this,e,f)}a=a.removedLinkKeys;if(Array.isArray(a))for(g=a.length,b=0;b<g;b++)c=this.Oh(a[b]),null!==c&&this.zm(c)};
Cr.prototype.changeState=function(a,b){if(null!==a&&a.model===this){if(a.change===se){var c=a.object,d=a.propertyName;if(d===this.linkKeyProperty&&this.Ec(c)){var e=a.K(b);b=a.K(!b);void 0!==b&&this.pb.remove(b);void 0!==e&&this.pb.add(e,c);Vj(c,d,e);return}}else if(a.change===ue){c=a.newParam;if("linkDataArray"===a.modelChange){a=a.newValue;Ga(a)&&"number"===typeof c&&(d=this.vc(a),b?(this.gg.remove(a),this.ed[c]===a&&this.ed.splice(c,1),void 0!==d&&this.pb.remove(d)):(this.gg.add(a),this.ed[c]!==
a&&this.ed.splice(c,0,a),void 0!==d&&this.pb.add(d,a)));return}if("linkLabelKeys"===a.modelChange){d=this.Nf(a.object);Array.isArray(d)&&"number"===typeof c&&(b?(c=d.indexOf(a.newValue),0<=c&&d.splice(c,1)):0>d.indexOf(a.newValue)&&d.splice(c,0,a.newValue));return}}else if(a.change===ve){c=a.oldParam;if("linkDataArray"===a.modelChange){a=a.oldValue;Ga(a)&&"number"===typeof c&&(d=this.vc(a),b?(this.gg.add(a),this.ed[c]!==a&&this.ed.splice(c,0,a),void 0!==d&&this.pb.add(d,a)):(this.gg.remove(a),this.ed[c]===
a&&this.ed.splice(c,1),void 0!==d&&this.pb.remove(d)));return}if("linkLabelKeys"===a.modelChange){d=this.Nf(a.object);Array.isArray(d)&&"number"===typeof c&&(b?0>d.indexOf(a.newValue)&&d.splice(c,0,a.newValue):(c=d.indexOf(a.newValue),0<=c&&d.splice(c,1)));return}}Y.prototype.changeState.call(this,a,b)}};t=Cr.prototype;t.tm=function(a){if(void 0!==a){var b=this.nj;if(null!==b){var c=this.cc(a);null===c&&(c=this.copyNodeData(b),Vj(c,this.nodeKeyProperty,a),this.Ef(c))}return a}};
t.ky=function(a){return Xq(this,a,!0)};t.Uv=function(a,b){er(this,a,b,!0)};t.ny=function(a){return Xq(this,a,!1)};t.Yv=function(a,b){er(this,a,b,!1)};function Xq(a,b,c){if(null!==b&&(a=c?a.nf:a.pf,""!==a&&(a=yn(b,a),void 0!==a))){if(Zq(a))return a;v((c?"FromKey":"ToKey")+" value for link data "+b+" is not a number or a string: "+a)}}
function er(a,b,c,d){null===c&&(c=void 0);void 0===c||Zq(c)||za(c,"number or string",Cr,d?"setFromKeyForLinkData:key":"setToKeyForLinkData:key");if(null!==b){var e=d?a.nf:a.pf;if(""!==e)if(c=a.tm(c),a.Ec(b)){var f=yn(b,e);f!==c&&(cr(a,f,b),Vj(b,e,c),null===a.cc(c)&&dr(a,c,b),wr(a,d?"linkFromKey":"linkToKey",se,e,b,f,c),"string"===typeof e&&a.Ka(b,e))}else Vj(b,e,c)}}t.ly=function(a){return Wq(this,a,!0)};t.Vv=function(a,b){fr(this,a,b,!0)};t.oy=function(a){return Wq(this,a,!1)};
t.Zv=function(a,b){fr(this,a,b,!1)};function Wq(a,b,c){if(null===b)return"";a=c?a.Fj:a.Gj;if(""===a)return"";b=yn(b,a);return void 0===b?"":b}function fr(a,b,c,d){A(c,"string",Cr,d?"setFromPortIdForLinkData:portname":"setToPortIdForLinkData:portname");if(null!==b){var e=d?a.Fj:a.Gj;if(""!==e)if(a.Ec(b)){var f=yn(b,e);void 0===f&&(f="");f!==c&&(Vj(b,e,c),wr(a,d?"linkFromPortId":"linkToPortId",se,e,b,f,c),"string"===typeof e&&a.Ka(b,e))}else Vj(b,e,c)}}
t.Nf=function(a){if(null===a)return Fr;var b=this.ie;if(""===b)return Fr;a=yn(a,b);return void 0===a?Fr:a};t.et=function(a,b){Ia(b,Cr,"setLabelKeysForLinkData:arr");if(null!==a){var c=this.ie;if(""!==c)if(this.Ec(a)){var d=yn(a,c);void 0===d&&(d=Fr);if(d!==b){if(Array.isArray(d))for(var e=d.length,f=0;f<e;f++)cr(this,d[f],a);Vj(a,c,b);e=b.length;for(f=0;f<e;f++){var g=b[f];null===this.cc(g)&&dr(this,g,a)}wr(this,"linkLabelKeys",se,c,a,d,b);"string"===typeof c&&this.Ka(a,c)}}else Vj(a,c,b)}};
t.Gu=function(a,b){if(null!==b&&void 0!==b&&(Zq(b)||za(b,"number or string",Cr,"addLabelKeyForLinkData:key"),null!==a)){var c=this.ie;if(""!==c){var d=yn(a,c);if(void 0===d)c=[],c.push(b),this.et(a,c);else if(Array.isArray(d)){var e=d.indexOf(b);0<=e||(e=d.length,d.push(b),this.Ec(a)&&(null===this.cc(b)&&dr(this,b,a),wr(this,"linkLabelKeys",ue,c,a,null,b,null,e)))}else v(c+" property is not an Array; cannot addLabelKeyForLinkData: "+a)}}};
t.Fy=function(a,b){if(null!==b&&void 0!==b&&(Zq(b)||za(b,"number or string",Cr,"removeLabelKeyForLinkData:key"),null!==a)){var c=this.ie;if(""!==c){var d=yn(a,c);if(Array.isArray(d)){var e=d.indexOf(b);0>e||(d.splice(e,1),this.Ec(a)&&(cr(this,b,a),wr(this,"linkLabelKeys",ve,c,a,b,null,e,null)))}else void 0!==d&&v(c+" property is not an Array; cannot removeLabelKeyforLinkData: "+a)}}};
t.vc=function(a){if(null!==a){var b=this.ti;if(""!==b&&(b=yn(a,b),void 0!==b)){if(Zq(b))return b;v("Key value for link data "+a+" is not a number or a string: "+b)}}};t.dt=function(a,b){void 0!==b&&null!==b&&Zq(b)||za(b,"number or string",Cr,"setKeyForLinkData:key");if(null!==a){var c=this.ti;if(""!==c)if(this.Ec(a)){var d=yn(a,c);d!==b&&null===this.Oh(b)&&(Vj(a,c,b),void 0!==d&&this.pb.remove(d),this.pb.add(b,a),wr(this,"linkKey",se,c,a,d,b),"string"===typeof c&&this.Ka(a,c))}else Vj(a,c,b)}};
t.Oh=function(a){null===a&&v("GraphLinksModel.findLinkDataForKey:key must not be null");return void 0!==a&&Zq(a)?this.pb.K(a):null};
t.Us=function(a){if(null!==a){var b=this.ti;if(""!==b){var c=this.vc(a);if(void 0===c||this.pb.contains(c)){var d=this.zl;if(null!==d&&(c=d(this,a),void 0!==c&&null!==c&&!this.pb.contains(c))){Vj(a,b,c);return}if("string"===typeof c){for(d=2;this.pb.contains(c+d);)d++;Vj(a,b,c+d)}else if(void 0===c||"number"===typeof c){for(c=-this.pb.count-1;this.pb.contains(c);)c--;Vj(a,b,c)}else G&&v("GraphLinksModel.getKeyForLinkData returned something other than a string or a number: "+c)}}}};
t.Ec=function(a){return null===a?!1:this.gg.contains(a)};t.Mi=function(a){null!==a&&(nb(a),this.Ec(a)||ar(this,a,!0))};function ar(a,b,c){if(""!==a.linkKeyProperty){var d=a.vc(b);if(void 0!==d&&a.pb.K(d)===b)return;a.Us(b);d=a.vc(b);void 0===d&&v("GraphLinksModel.makeLinkDataKeyUnique failed on "+b+". Data not added to model.");a.pb.add(d,b)}a.gg.add(b);d=null;c&&(d=a.ed.length,a.ed.splice(d,0,b));wr(a,"linkDataArray",ue,"linkDataArray",a,null,b,null,d);Gr(a,b)}
t.qz=function(a){if(Array.isArray(a))for(var b=a.length,c=0;c<b;c++)this.Mi(a[c]);else for(a=a.iterator;a.next();)this.Mi(a.value)};t.zm=function(a){null!==a&&$q(this,a,!0)};function $q(a,b,c){a.gg.remove(b);var d=a.vc(b);void 0!==d&&a.pb.remove(d);d=null;if(c){d=a.ed.indexOf(b);if(0>d)return;a.ed.splice(d,1)}wr(a,"linkDataArray",ve,"linkDataArray",a,b,null,d,null);c=Xq(a,b,!0);cr(a,c,b);c=Xq(a,b,!1);cr(a,c,b);d=a.Nf(b);if(Array.isArray(d))for(var e=d.length,f=0;f<e;f++)c=d[f],cr(a,c,b)}
t.$A=function(a){if(Array.isArray(a))for(var b=a.length,c=0;c<b;c++)this.zm(a[c]);else for(a=a.iterator;a.next();)this.zm(a.value)};
t.OA=function(a){""===this.linkKeyProperty&&v("GraphLinksModel.linkKeyProperty must not be an empty string for .mergeLinkDataArray() to succeed.");if(a!==this.linkDataArray&&Ha(a)){var b=this.Gl;b.clear();b.addAll(this.pb.iteratorKeys);var c=this.El;c.clear();for(var d=a.length,e=0;e<d;e++){var f=a[e],g=this.vc(f);if(void 0!==g){c.add(g);var h=this.Oh(g);h!==f&&(null!==h?(this.Zp(h,f),Er(this,f,h)):(f=this.cloneDeep(f),this.dt(f,g),this.Mi(f)))}else g=this.cloneDeep(f),this.Mi(g),c.add(this.vc(g))}for(a=
b.iterator;a.next();)d=a.value,c.contains(d)||(d=this.Oh(d))&&this.zm(d);b.clear();c.clear()}};function Gr(a,b){var c=Xq(a,b,!0);c=a.tm(c);null===a.cc(c)&&dr(a,c,b);c=Xq(a,b,!1);c=a.tm(c);null===a.cc(c)&&dr(a,c,b);var d=a.Nf(b);if(Array.isArray(d))for(var e=d.length,f=0;f<e;f++)c=d[f],null===a.cc(c)&&dr(a,c,b)}
t.eq=function(a){if(null===a)return null;var b=this.Tk;a=null!==b?b(a,this):yr(this,a,!0);Ga(a)&&(ab(a),""!==this.nf&&Vj(a,this.nf,void 0),""!==this.pf&&Vj(a,this.pf,void 0),""!==this.ie&&Vj(a,this.ie,[]));return a};t.Os=function(a){if(null===a)return!1;var b=this.Fl;return""===b?!1:yn(a,b)?!0:!1};t.Ph=function(a){if(null!==a){var b=this.Le;if(""!==b&&(b=yn(a,b),void 0!==b)){if(Zq(b))return b;v("GroupKey value for node data "+a+" is not a number or a string: "+b)}}};
t.Hq=function(a,b){null===b&&(b=void 0);void 0===b||Zq(b)||za(b,"number or string",Cr,"setGroupKeyForNodeData:key");if(null!==a){var c=this.Le;if(""!==c)if(this.ab(a)){var d=yn(a,c);d!==b&&(cr(this,d,a),Vj(a,c,b),null===this.cc(b)&&dr(this,b,a),wr(this,"nodeGroupKey",se,c,a,d,b),"string"===typeof c&&this.Ka(a,c))}else Vj(a,c,b)}};
Cr.prototype.copyNodeData=function(a){if(null===a)return null;a=Y.prototype.copyNodeData.call(this,a);this.ck||""===this.Le||void 0===yn(a,this.Le)||Vj(a,this.Le,void 0);return a};
Cr.prototype.setDataProperty=function(a,b,c){G&&(A(a,"object",Cr,"setDataProperty:data"),A(b,"string",Cr,"setDataProperty:propname"),""===b&&v("GraphLinksModel.setDataProperty: property name must not be an empty string when setting "+a+" to "+c));if(this.ab(a)){if(b===this.nodeKeyProperty){this.Im(a,c);return}if(b===this.nodeCategoryProperty){this.Hm(a,c);return}if(b===this.nodeGroupKeyProperty){this.Hq(a,c);return}G&&b===this.nodeIsGroupProperty&&v("GraphLinksModel.setDataProperty: property name must not be the nodeIsGroupProperty: "+
b)}else if(this.Ec(a)){if(b===this.linkFromKeyProperty){er(this,a,c,!0);return}if(b===this.linkToKeyProperty){er(this,a,c,!1);return}if(b===this.linkFromPortIdProperty){fr(this,a,c,!0);return}if(b===this.linkToPortIdProperty){fr(this,a,c,!1);return}if(b===this.linkKeyProperty){this.dt(a,c);return}if(b===this.linkCategoryProperty){this.Gq(a,c);return}if(b===this.linkLabelKeysProperty){this.et(a,c);return}}var d=yn(a,b);d!==c&&(Vj(a,b,c),this.$s(a,b,d,c))};t=Cr.prototype;
t.Zp=function(a,b){if(b){var c=this.ab(a),d=this.Ec(a),e;for(e in b)"__gohashid"===e||c&&e===this.nodeKeyProperty||c&&e===this.nodeIsGroupProperty&&yn(a,e)===b[e]||d&&e===this.linkKeyProperty||this.setDataProperty(a,e,b[e])}};
t.Eq=function(a,b){Y.prototype.Eq.call(this,a,b);for(var c=this.jb.iterator;c.next();)this.Pv(c.value,a,b);for(c=this.gg.iterator;c.next();){var d=c.value,e=a,f=b;if(Xq(this,d,!0)===e){var g=this.nf;Vj(d,g,f);wr(this,"linkFromKey",se,g,d,e,f);"string"===typeof g&&this.Ka(d,g)}Xq(this,d,!1)===e&&(g=this.pf,Vj(d,g,f),wr(this,"linkToKey",se,g,d,e,f),"string"===typeof g&&this.Ka(d,g));g=this.Nf(d);if(Array.isArray(g))for(var h=g.length,k=this.ie,l=0;l<h;l++)g[l]===e&&(g[l]=f,wr(this,"linkLabelKeys",ue,
k,d,e,f,l,l))}};t.Pv=function(a,b,c){if(this.Ph(a)===b){var d=this.Le;Vj(a,d,c);wr(this,"nodeGroupKey",se,d,a,b,c);"string"===typeof d&&this.Ka(a,d)}};t.hw=function(){Y.prototype.hw.call(this);for(var a=this.linkDataArray,b=a.length,c=0;c<b;c++)Gr(this,a[c])};
t.Dm=function(a){Y.prototype.Dm.call(this,a);a=this.va(a);var b=br(this,a);if(null!==b){var c=Na();for(b=b.iterator;b.next();){var d=b.value;if(this.ab(d)){if(this.Ph(d)===a){var e=this.Le;wr(this,"nodeGroupKey",se,e,d,a,a);"string"===typeof e&&this.Ka(d,e);c.push(d)}}else if(Xq(this,d,!0)===a&&(e=this.nf,wr(this,"linkFromKey",se,e,d,a,a),"string"===typeof e&&this.Ka(d,e),c.push(d)),Xq(this,d,!1)===a&&(e=this.pf,wr(this,"linkToKey",se,e,d,a,a),"string"===typeof e&&this.Ka(d,e),c.push(d)),e=this.Nf(d),
Array.isArray(e))for(var f=e.length,g=this.ie,h=0;h<f;h++)e[h]===a&&(wr(this,"linkLabelKeys",ue,g,d,a,a,h,h),c.push(d))}for(b=0;b<c.length;b++)cr(this,a,c[b]);Pa(c)}};t.Cm=function(a){Y.prototype.Cm.call(this,a);var b=this.Ph(a);null===this.cc(b)&&dr(this,b,a)};t.Lq=function(a){Y.prototype.Lq.call(this,a);var b=this.Ph(a);cr(this,b,a)};
t.Gs=function(a){if(null===a)return"";var b=this.Ej;if(""===b)return"";b=yn(a,b);if(void 0===b)return"";if("string"===typeof b)return b;v("getCategoryForLinkData found a non-string category for "+a+": "+b)};Cr.prototype.getLinkCategoryForData=function(a){return this.Gs(a)};
Cr.prototype.Gq=function(a,b){A(b,"string",Cr,"setCategoryForLinkData:cat");if(null!==a){var c=this.Ej;if(""!==c)if(this.Ec(a)){var d=yn(a,c);void 0===d&&(d="");d!==b&&(Vj(a,c,b),wr(this,"linkCategory",se,c,a,d,b),"string"===typeof c&&this.Ka(a,c))}else Vj(a,c,b)}};Cr.prototype.setLinkCategoryForData=function(a,b){this.Gq(a,b)};t=Cr.prototype;t.Jm=function(a,b){Y.prototype.Jm.call(this,a,b);this.Hq(b,this.Ph(a))};
function Er(a,b,c){a.Gq(c,a.Gs(b));a.Uv(c,a.ky(b));a.Yv(c,a.ny(b));a.et(c,a.Nf(b));a.Vv(c,a.ly(b));a.Zv(c,a.oy(b))}t.nk=function(){return!0};t.aj=function(){return!0};t.Qs=function(){return!0};t.Zi=function(){return!0};
na.Object.defineProperties(Cr.prototype,{archetypeNodeData:{configurable:!0,get:function(){return this.nj},set:function(a){var b=this.nj;b!==a&&(null!==a&&A(a,"object",Cr,"archetypeNodeData"),this.nj=a,this.g("archetypeNodeData",b,a))}},linkFromKeyProperty:{configurable:!0,get:function(){return this.nf},set:function(a){var b=this.nf;b!==a&&(xr(a,Cr,"linkFromKeyProperty"),this.nf=a,this.g("linkFromKeyProperty",b,a))}},linkToKeyProperty:{configurable:!0,get:function(){return this.pf},
set:function(a){var b=this.pf;b!==a&&(xr(a,Cr,"linkToKeyProperty"),this.pf=a,this.g("linkToKeyProperty",b,a))}},linkFromPortIdProperty:{configurable:!0,get:function(){return this.Fj},set:function(a){var b=this.Fj;b!==a&&(xr(a,Cr,"linkFromPortIdProperty"),!G||a!==this.linkFromKeyProperty&&a!==this.linkToKeyProperty||v("linkFromPortIdProperty name must not be the same as the GraphLinksModel.linkFromKeyProperty or linkToKeyProperty: "+a),this.Fj=a,this.g("linkFromPortIdProperty",b,a))}},
linkToPortIdProperty:{configurable:!0,get:function(){return this.Gj},set:function(a){var b=this.Gj;b!==a&&(xr(a,Cr,"linkToPortIdProperty"),!G||a!==this.linkFromKeyProperty&&a!==this.linkToKeyProperty||v("linkFromPortIdProperty name must not be the same as the GraphLinksModel.linkFromKeyProperty or linkToKeyProperty: "+a),this.Gj=a,this.g("linkToPortIdProperty",b,a))}},linkLabelKeysProperty:{configurable:!0,get:function(){return this.ie},set:function(a){var b=this.ie;b!==
a&&(xr(a,Cr,"linkLabelKeysProperty"),this.ie=a,this.g("linkLabelKeysProperty",b,a))}},linkDataArray:{configurable:!0,get:function(){return this.ed},set:function(a){var b=this.ed;if(b!==a){Ia(a,Cr,"linkDataArray");this.pb.clear();for(var c=a.length,d=0;d<c;d++){var e=a[d];Ga(e)||v("GraphLinksModel.linkDataArray must only contain Objects, not: "+e);nb(e)}this.ed=a;if(""!==this.linkKeyProperty){d=new H;for(e=0;e<c;e++){var f=a[e],g=this.vc(f);void 0===g?d.add(f):null!==this.pb.K(g)?d.add(f):
this.pb.add(g,f)}for(d=d.iterator;d.next();)e=d.value,this.Us(e),f=this.vc(e),void 0!==f&&this.pb.add(f,e)}d=new I;for(e=0;e<c;e++)d.add(a[e]);this.gg=d;wr(this,"linkDataArray",se,"linkDataArray",this,b,a);for(b=0;b<c;b++)Gr(this,a[b])}}},linkKeyProperty:{configurable:!0,get:function(){return this.ti},set:function(a){var b=this.ti;if(b!==a){xr(a,Cr,"linkKeyProperty");this.ti=a;this.pb.clear();for(var c=this.linkDataArray.length,d=0;d<c;d++){var e=this.linkDataArray[d],f=this.vc(e);void 0===
f&&(this.Us(e),f=this.vc(e));void 0!==f&&this.pb.add(f,e)}this.g("linkKeyProperty",b,a)}}},makeUniqueLinkKeyFunction:{configurable:!0,get:function(){return this.zl},set:function(a){var b=this.zl;b!==a&&(null!==a&&A(a,"function",Cr,"makeUniqueLinkKeyFunction"),this.zl=a,this.g("makeUniqueLinkKeyFunction",b,a))}},copyLinkDataFunction:{configurable:!0,get:function(){return this.Tk},set:function(a){var b=this.Tk;b!==a&&(null!==a&&A(a,"function",Cr,"copyLinkDataFunction"),this.Tk=
a,this.g("copyLinkDataFunction",b,a))}},nodeIsGroupProperty:{configurable:!0,get:function(){return this.Fl},set:function(a){var b=this.Fl;b!==a&&(xr(a,Cr,"nodeIsGroupProperty"),this.Fl=a,this.g("nodeIsGroupProperty",b,a))}},nodeGroupKeyProperty:{configurable:!0,get:function(){return this.Le},set:function(a){var b=this.Le;b!==a&&(xr(a,Cr,"nodeGroupKeyProperty"),this.Le=a,this.g("nodeGroupKeyProperty",b,a))}},ck:{configurable:!0,get:function(){return this.qn},
set:function(a){this.qn!==a&&(A(a,"boolean",Cr,"copiesGroupKeyOfNodeData"),this.qn=a)}},linkCategoryProperty:{configurable:!0,get:function(){return this.Ej},set:function(a){var b=this.Ej;b!==a&&(xr(a,Cr,"linkCategoryProperty"),this.Ej=a,this.g("linkCategoryProperty",b,a))}},type:{configurable:!0,get:function(){return"GraphLinksModel"}}});Cr.prototype.setCategoryForLinkData=Cr.prototype.Gq;Cr.prototype.getCategoryForLinkData=Cr.prototype.Gs;
Cr.prototype.assignAllDataProperties=Cr.prototype.Zp;Cr.prototype.setGroupKeyForNodeData=Cr.prototype.Hq;Cr.prototype.getGroupKeyForNodeData=Cr.prototype.Ph;Cr.prototype.isGroupForNodeData=Cr.prototype.Os;Cr.prototype.copyLinkData=Cr.prototype.eq;Cr.prototype.mergeLinkDataArray=Cr.prototype.OA;Cr.prototype.removeLinkDataCollection=Cr.prototype.$A;Cr.prototype.removeLinkData=Cr.prototype.zm;Cr.prototype.addLinkDataCollection=Cr.prototype.qz;Cr.prototype.addLinkData=Cr.prototype.Mi;
Cr.prototype.containsLinkData=Cr.prototype.Ec;Cr.prototype.makeLinkDataKeyUnique=Cr.prototype.Us;Cr.prototype.findLinkDataForKey=Cr.prototype.Oh;Cr.prototype.setKeyForLinkData=Cr.prototype.dt;Cr.prototype.getKeyForLinkData=Cr.prototype.vc;Cr.prototype.removeLabelKeyForLinkData=Cr.prototype.Fy;Cr.prototype.addLabelKeyForLinkData=Cr.prototype.Gu;Cr.prototype.setLabelKeysForLinkData=Cr.prototype.et;Cr.prototype.getLabelKeysForLinkData=Cr.prototype.Nf;Cr.prototype.setToPortIdForLinkData=Cr.prototype.Zv;
Cr.prototype.getToPortIdForLinkData=Cr.prototype.oy;Cr.prototype.setFromPortIdForLinkData=Cr.prototype.Vv;Cr.prototype.getFromPortIdForLinkData=Cr.prototype.ly;Cr.prototype.setToKeyForLinkData=Cr.prototype.Yv;Cr.prototype.getToKeyForLinkData=Cr.prototype.ny;Cr.prototype.setFromKeyForLinkData=Cr.prototype.Uv;Cr.prototype.getFromKeyForLinkData=Cr.prototype.ky;Cr.prototype.clear=Cr.prototype.clear;var Fr=Object.freeze([]);Cr.className="GraphLinksModel";Ar.GraphLinksModel=Cr;
Y.constructGraphLinksModel=Y.constructGraphLinksModel=function(){return new Cr};Y.initDiagramModel=xi=function(){return new Cr};function Hr(a,b){Y.call(this);this.Me="parent";this.sn=!1;this.Mj="parentLinkCategory";void 0!==a&&(Ha(a)?this.nodeDataArray=a:Object.assign(this,a));b&&Object.assign(this,b)}ma(Hr,Y);Hr.constructGraphLinksModel=Y.constructGraphLinksModel;Hr.prototype.cloneProtected=function(a){Y.prototype.cloneProtected.call(this,a);a.Me=this.Me;a.sn=this.sn;a.Mj=this.Mj};t=Hr.prototype;
t.toString=function(a){void 0===a&&(a=0);if(2<=a)return this.Iq();var b=(""!==this.name?this.name:"")+" TreeModel";if(0<a){b+="\n node data:";a=this.nodeDataArray;for(var c=a.length,d=0;d<c;d++){var e=a[d];b+=" "+this.va(e)+":"+Ra(e)}}return b};t.Qm=function(){var a=Y.prototype.Qm.call(this),b="";"parent"!==this.nodeParentKeyProperty&&"string"===typeof this.nodeParentKeyProperty&&(b+=',\n  "nodeParentKeyProperty": '+this.quote(this.nodeParentKeyProperty));return a+b};
t.Aq=function(a){Y.prototype.Aq.call(this,a);a.nodeParentKeyProperty&&(this.nodeParentKeyProperty=a.nodeParentKeyProperty)};t.zq=function(a){void 0!==a.nodeParentKeyProperty&&a.nodeParentKeyProperty!==this.nodeParentKeyProperty&&v("applyIncrementalJson cannot change Model properties");Y.prototype.zq.call(this,a)};t.tm=function(a){return a};
t.Qh=function(a){if(null!==a){var b=this.Me;if(""!==b&&(b=yn(a,b),void 0!==b)){if(Zq(b))return b;v("ParentKey value for node data "+a+" is not a number or a string: "+b)}}};
t.pe=function(a,b){null===b&&(b=void 0);void 0===b||Zq(b)||za(b,"number or string",Hr,"setParentKeyForNodeData:key");if(null!==a){var c=this.Me;if(""!==c)if(b=this.tm(b),this.ab(a)){var d=yn(a,c);d!==b&&(cr(this,d,a),Vj(a,c,b),null===this.cc(b)&&dr(this,b,a),wr(this,"nodeParentKey",se,c,a,d,b),"string"===typeof c&&this.Ka(a,c))}else Vj(a,c,b)}};
t.Js=function(a){if(null===a)return"";var b=this.Mj;if(""===b)return"";b=yn(a,b);if(void 0===b)return"";if("string"===typeof b)return b;v("getParentLinkCategoryForNodeData found a non-string category for "+a+": "+b);return""};Hr.prototype.getLinkCategoryForData=function(a){return this.Js(a)};
Hr.prototype.ft=function(a,b){A(b,"string",Hr,"setParentLinkCategoryForNodeData:cat");if(null!==a){var c=this.Mj;if(""!==c)if(this.ab(a)){var d=yn(a,c);void 0===d&&(d="");d!==b&&(Vj(a,c,b),wr(this,"parentLinkCategory",se,c,a,d,b),"string"===typeof c&&this.Ka(a,c))}else Vj(a,c,b)}};Hr.prototype.setLinkCategoryForData=function(a,b){this.ft(a,b)};
Hr.prototype.copyNodeData=function(a){if(null===a)return null;a=Y.prototype.copyNodeData.call(this,a);this.dk||""===this.Me||void 0===yn(a,this.Me)||Vj(a,this.Me,void 0);return a};
Hr.prototype.setDataProperty=function(a,b,c){G&&(A(a,"object",Hr,"setDataProperty:data"),A(b,"string",Hr,"setDataProperty:propname"),""===b&&v("TreeModel.setDataProperty: property name must not be an empty string when setting "+a+" to "+c));if(this.ab(a)){if(b===this.nodeKeyProperty){this.Im(a,c);return}if(b===this.nodeCategoryProperty){this.Hm(a,c);return}if(b===this.nodeParentKeyProperty){this.pe(a,c);return}}var d=yn(a,b);d!==c&&(Vj(a,b,c),this.$s(a,b,d,c))};t=Hr.prototype;
t.Eq=function(a,b){Y.prototype.Eq.call(this,a,b);for(var c=this.jb.iterator;c.next();)this.Pv(c.value,a,b)};t.Pv=function(a,b,c){if(this.Qh(a)===b){var d=this.Me;Vj(a,d,c);wr(this,"nodeParentKey",se,d,a,b,c);"string"===typeof d&&this.Ka(a,d)}};
t.Dm=function(a){Y.prototype.Dm.call(this,a);a=this.va(a);var b=br(this,a);if(null!==b){var c=Na();for(b=b.iterator;b.next();){var d=b.value;if(this.ab(d)&&this.Qh(d)===a){var e=this.Me;wr(this,"nodeParentKey",se,e,d,a,a);"string"===typeof e&&this.Ka(d,e);c.push(d)}}for(b=0;b<c.length;b++)cr(this,a,c[b]);Pa(c)}};t.Cm=function(a){Y.prototype.Cm.call(this,a);var b=this.Qh(a);b=this.tm(b);null===this.cc(b)&&dr(this,b,a)};t.Lq=function(a){Y.prototype.Lq.call(this,a);var b=this.Qh(a);cr(this,b,a)};
t.Jm=function(a,b){Y.prototype.Jm.call(this,a,b);this.ft(b,this.Js(a));this.pe(b,this.Qh(a))};t.rm=function(){return!0};t.Qs=function(){return!0};
na.Object.defineProperties(Hr.prototype,{nodeParentKeyProperty:{configurable:!0,get:function(){return this.Me},set:function(a){var b=this.Me;b!==a&&(xr(a,Hr,"nodeParentKeyProperty"),this.Me=a,this.g("nodeParentKeyProperty",b,a))}},dk:{configurable:!0,get:function(){return this.sn},set:function(a){this.sn!==a&&(A(a,"boolean",Hr,"copiesParentKeyOfNodeData"),this.sn=a)}},parentLinkCategoryProperty:{configurable:!0,get:function(){return this.Mj},set:function(a){var b=
this.Mj;b!==a&&(xr(a,Hr,"parentLinkCategoryProperty"),this.Mj=a,this.g("parentLinkCategoryProperty",b,a))}},linkCategoryProperty:{configurable:!0,get:function(){return this.parentLinkCategoryProperty},set:function(a){this.parentLinkCategoryProperty=a}},type:{configurable:!0,get:function(){return"TreeModel"}}});Hr.prototype.setParentLinkCategoryForNodeData=Hr.prototype.ft;Hr.prototype.getParentLinkCategoryForNodeData=Hr.prototype.Js;
Hr.prototype.setParentKeyForNodeData=Hr.prototype.pe;Hr.prototype.getParentKeyForNodeData=Hr.prototype.Qh;Hr.className="TreeModel";Ar.TreeModel=Hr;function Ir(a){zi.call(this);this.Yw=this.Fn=this.hc=0;this.ir=360;this.Xw=Jr;this.rj=0;this.Nw=new K;this.ar=this.le=0;this.ss=new Kr;this.Gt=this.Lj=0;this.gz=600;this.fp=NaN;this.en=1;this.Hp=0;this.Yl=360;this.Nb=Jr;this.N=Lr;this.gd=Mr;this.Zc=Aq;this.wf=6;this.Po=Nr;a&&Object.assign(this,a)}ma(Ir,zi);
Ir.prototype.cloneProtected=function(a){zi.prototype.cloneProtected.call(this,a);a.fp=this.fp;a.en=this.en;a.Hp=this.Hp;a.Yl=this.Yl;a.Nb=this.Nb;a.N=this.N;a.gd=this.gd;a.Zc=this.Zc;a.wf=this.wf;a.Po=this.Po};
Ir.prototype.mb=function(a){if(a.classType===Ir)if(a===Or||a===Pr||a===Qr||a===Rr||a===Mr)this.sorting=a;else if(a===Sr||a===Tr||a===Lr||a===Ur)this.direction=a;else if(a===Vr||a===Wr||a===Jr||a===Xr)this.arrangement=a;else{if(a===Yr||a===Nr)this.nodeDiameterFormula=a}else zi.prototype.mb.call(this,a)};Ir.prototype.createNetwork=function(){return new Zr(this)};
Ir.prototype.doLayout=function(a){G&&null===a&&v("Layout.doLayout(collection) argument must not be null but a Diagram, a Group, or an Iterable of Parts");null===this.network&&(this.network=this.makeNetwork(a));this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);a=this.network.vertexes;if(1>=a.count)1===a.count&&(a=a.first(),a.centerX=0,a.centerY=0);else{var b=new H;b.addAll(a.iterator);a=new H;var c=new H;var d=this.sort(b);var e,f,g=this.ar;var h=this.arrangement;var k=this.nodeDiameterFormula;
var l=this.radius;if(!isFinite(l)||0>=l)l=NaN;var m=this.aspectRatio;if(!isFinite(m)||0>=m)m=1;var n=this.startAngle;isFinite(n)||(n=0);var p=this.sweepAngle;if(!isFinite(p)||360<p||1>p)p=360;b=this.spacing;isFinite(b)||(b=NaN);h===Xr&&k===Yr?h=Jr:h===Xr&&k!==Yr&&(h=this.arrangement);if((this.direction===Sr||this.direction===Tr)&&this.sorting!==Mr){for(k=0;!(k>=d.length);k+=2){a.add(d.M(k));if(k+1>=d.length)break;c.add(d.M(k+1))}this.direction===Sr?(this.arrangement===Xr&&a.reverse(),d=new H,d.addAll(a),
d.addAll(c)):(this.arrangement===Xr&&c.reverse(),d=new H,d.addAll(c),d.addAll(a))}k=d.length;for(var r=f=e=0;r<d.length;r++){var q=n+p*f*(this.direction===Lr?1:-1)/k,u=d.M(r).diameter;isNaN(u)&&(u=$r(d.M(r),q));360>p&&(0===r||r===d.length-1)&&(u/=2);e+=u;f++}if(isNaN(l)||h===Xr){isNaN(b)&&(b=6);if(h!==Jr&&h!==Xr){f=-Infinity;for(g=0;g<k;g++)r=d.M(g),e=d.M(g===k-1?0:g+1),isNaN(r.diameter)&&$r(r,0),isNaN(e.diameter)&&$r(e,0),f=Math.max(f,(r.diameter+e.diameter)/2);g=f+b;h===Vr?l=(f+b)/(2*Math.PI/k):
l=as(this,g*(360<=p?k:k-1),m,n*Math.PI/180,p*Math.PI/180)}else l=as(this,e+(360<=p?k:k-1)*(h!==Xr?b:1.6*b),m,n*Math.PI/180,p*Math.PI/180);f=l*m}else if(f=l*m,r=bs(this,l,f,n*Math.PI/180,p*Math.PI/180),isNaN(b)){if(h===Jr||h===Xr)b=(r-e)/(360<=p?k:k-1)}else if(h===Jr||h===Xr)r=(r-e)/(360<=p?k:k-1),r<b?(l=as(this,e+b*(360<=p?k:k-1),m,n*Math.PI/180,p*Math.PI/180),f=l*m):b=r;else{g=-Infinity;for(e=0;e<k;e++)q=d.M(e),u=d.M(e===k-1?0:e+1),isNaN(q.diameter)&&$r(q,0),isNaN(u.diameter)&&$r(u,0),g=Math.max(g,
(q.diameter+u.diameter)/2);g+=b;e=as(this,g*(360<=p?k:k-1),m,n*Math.PI/180,p*Math.PI/180);e>l?(l=e,f=l*m):g=r/(360<=p?k:k-1)}this.Xw=h;this.hc=l;this.Fn=m;this.Yw=n;this.ir=p;this.rj=b;this.le=f;this.ar=g;b=d;d=this.Xw;h=this.hc;l=this.Yw;m=this.ir;n=this.rj;p=this.le;k=this.ar;if(this.direction!==Sr&&this.direction!==Tr||d!==Xr)if(this.direction===Sr||this.direction===Tr){g=0;switch(d){case Wr:g=180*cs(this,h,p,l,k)/Math.PI;break;case Jr:k=b=0;g=a.first();null!==g&&(b=$r(g,Math.PI/2));g=c.first();
null!==g&&(k=$r(g,Math.PI/2));g=180*cs(this,h,p,l,n+(b+k)/2)/Math.PI;break;case Vr:g=m/b.length}if(this.direction===Sr){switch(d){case Wr:ds(this,a,l,Ur);break;case Jr:es(this,a,l,Ur);break;case Vr:fs(this,a,m/2,l,Ur)}switch(d){case Wr:ds(this,c,l+g,Lr);break;case Jr:es(this,c,l+g,Lr);break;case Vr:fs(this,c,m/2,l+g,Lr)}}else{switch(d){case Wr:ds(this,c,l,Ur);break;case Jr:es(this,c,l,Ur);break;case Vr:fs(this,c,m/2,l,Ur)}switch(d){case Wr:ds(this,a,l+g,Lr);break;case Jr:es(this,a,l+g,Lr);break;case Vr:fs(this,
a,m/2,l+g,Lr)}}}else switch(d){case Wr:ds(this,b,l,this.direction);break;case Jr:es(this,b,l,this.direction);break;case Vr:fs(this,b,m,l,this.direction);break;case Xr:gs(this,b,m,l,this.direction)}else gs(this,b,m,l-m/2,Lr)}this.updateParts();this.network=null;this.isValidLayout=!0};
function fs(a,b,c,d,e){var f=a.ir,g=a.hc;a=a.le;d=d*Math.PI/180;c=c*Math.PI/180;for(var h=b.length,k=0;k<h;k++){var l=d+(e===Lr?k*c/(360<=f?h:h-1):-(k*c)/h),m=b.M(k),n=g*Math.tan(l)/a;n=Math.sqrt((g*g+a*a*n*n)/(1+n*n));m.centerX=n*Math.cos(l);m.centerY=n*Math.sin(l);m.actualAngle=180*l/Math.PI}}
function es(a,b,c,d){var e=a.hc,f=a.le,g=a.rj;c=c*Math.PI/180;for(var h=b.length,k=0;k<h;k++){var l=b.M(k),m=b.M(k===h-1?0:k+1),n=f*Math.sin(c);l.centerX=e*Math.cos(c);l.centerY=n;l.actualAngle=180*c/Math.PI;isNaN(l.diameter)&&$r(l,0);isNaN(m.diameter)&&$r(m,0);l=cs(a,e,f,d===Lr?c:-c,(l.diameter+m.diameter)/2+g);c+=d===Lr?l:-l}}
function ds(a,b,c,d){var e=a.hc,f=a.le,g=a.ar;c=c*Math.PI/180;for(var h=b.length,k=0;k<h;k++){var l=b.M(k);l.centerX=e*Math.cos(c);l.centerY=f*Math.sin(c);l.actualAngle=180*c/Math.PI;l=cs(a,e,f,d===Lr?c:-c,g);c+=d===Lr?l:-l}}function gs(a,b,c,d,e){var f=a.ir;a.Lj=0;a.ss=new Kr;if(360>c){for(f=d+(e===Lr?f:-f);0>f;)f+=360;f%=360;180<f&&(f-=360);f*=Math.PI/180;a.Gt=f;hs(a,b,c,d,e)}else is(a,b,c,d,e);a.ss.commit(b)}
function is(a,b,c,d,e){var f=a.hc,g=a.rj,h=a.Fn,k=f*Math.cos(d*Math.PI/180),l=a.le*Math.sin(d*Math.PI/180),m=b.Fa();if(3===m.length)m[0].centerX=f,m[0].centerY=0,m[1].centerX=m[0].centerX-m[0].width/2-m[1].width/2-g,m[1].y=m[0].y,m[2].centerX=(m[0].centerX+m[1].centerX)/2,m[2].y=m[0].y-m[2].height-g;else if(4===m.length)m[0].centerX=f,m[0].centerY=0,m[2].centerX=-m[0].centerX,m[2].centerY=m[0].centerY,m[1].centerX=0,m[1].y=Math.min(m[0].y,m[2].y)-m[1].height-g,m[3].centerX=0,m[3].y=Math.max(m[0].y+
m[0].height+g,m[2].y+m[2].height+g);else{f=K.alloc();for(var n=0;n<m.length;n++){m[n].centerX=k;m[n].centerY=l;if(n>=m.length-1)break;js(a,k,l,m,n,e,f)||ks(a,k,l,m,n,e,f);k=f.x;l=f.y}K.free(f);a.Lj++;if(!(23<a.Lj)){k=m[0].centerX;l=m[0].centerY;f=m[m.length-1].centerX;n=m[m.length-1].centerY;var p=Math.abs(k-f)-((m[0].width+m[m.length-1].width)/2+g),r=Math.abs(l-n)-((m[0].height+m[m.length-1].height)/2+g);g=0;1>Math.abs(r)?Math.abs(k-f)<(m[0].width+m[m.length-1].width)/2&&(g=0):g=0<r?r:1>Math.abs(p)?
0:p;k=Math.abs(f)>Math.abs(n)?0<f!==l>n:0<n!==k<f;if(k=e===Lr?k:!k)g=-Math.abs(g),g=Math.min(g,-m[m.length-1].width),g=Math.min(g,-m[m.length-1].height);a.ss.compare(g,m);1<Math.abs(g)&&(a.hc=8>a.Lj?a.hc-g/(2*Math.PI):5>m.length&&10<g?a.hc/2:a.hc-(0<g?1.7:-2.3),a.le=a.hc*h,is(a,b,c,d,e))}}}
function hs(a,b,c,d,e){for(var f=a.hc,g=a.le,h=a.Fn,k=f*Math.cos(d*Math.PI/180),l=g*Math.sin(d*Math.PI/180),m=K.alloc(),n=b.Fa(),p=0;p<n.length;p++){n[p].centerX=k;n[p].centerY=l;if(p>=n.length-1)break;js(a,k,l,n,p,e,m)||ks(a,k,l,n,p,e,m);k=m.x;l=m.y}K.free(m);a.Lj++;if(!(23<a.Lj)){k=Math.atan2(l,k);k=e===Lr?a.Gt-k:k-a.Gt;k=Math.abs(k)<Math.abs(k-2*Math.PI)?k:k-2*Math.PI;f=k*(f+g)/2;g=a.ss;if(Math.abs(f)<Math.abs(g.nm))for(g.nm=f,g.Ck=[],g.Sm=[],k=0;k<n.length;k++)g.Ck[k]=n[k].bounds.x,g.Sm[k]=n[k].bounds.y;
1<Math.abs(f)&&(a.hc=8>a.Lj?a.hc-f/(2*Math.PI):a.hc-(0<f?1.7:-2.3),a.le=a.hc*h,hs(a,b,c,d,e))}}function js(a,b,c,d,e,f,g){var h=a.hc,k=a.le,l=0;a=(d[e].width+d[e+1].width)/2+a.rj;var m=!1;if(0<=c!==(f===Lr)){if(f=b+a,f>h){f=b-a;if(f<-h)return g.x=f,g.y=l,!1;m=!0}}else if(f=b-a,f<-h){f=b+a;if(f>h)return g.x=f,g.y=l,!1;m=!0}l=Math.sqrt(1-Math.min(1,f*f/(h*h)))*k;0>c!==m&&(l=-l);if(Math.abs(c-l)>(d[e].height+d[e+1].height)/2)return g.x=f,g.y=l,!1;g.x=f;g.y=l;return!0}
function ks(a,b,c,d,e,f,g){var h=a.hc,k=a.le,l=0;a=(d[e].height+d[e+1].height)/2+a.rj;d=!1;if(0<=b!==(f===Lr)){if(f=c-a,f<-k){f=c+a;if(f>k){g.x=l;g.y=f;return}d=!0}}else if(f=c+a,f>k){f=c-a;if(f<-k){g.x=l;g.y=f;return}d=!0}l=Math.sqrt(1-Math.min(1,f*f/(k*k)))*h;0>b!==d&&(l=-l);g.x=l;g.y=f}Ir.prototype.commitLayout=function(){this.commitNodes();this.isRouting&&this.commitLinks()};
Ir.prototype.commitNodes=function(){var a=null!==this.group&&null!==this.group.placeholder&&this.group.isSubGraphExpanded,b=a?this.group.location.copy():null,c=this.actualCenter;a?c=new K(0,0):(c.x=this.arrangementOrigin.x+this.hc,c.y=this.arrangementOrigin.y+this.le);for(var d=this.network.vertexes.iterator;d.next();){var e=d.value;e.x+=c.x;e.y+=c.y;e.commit()}a&&(this.group.Ya(),a=this.group.position.copy(),c=this.group.location.copy(),b=b.qe(c.qe(a)),this.group.move(b),this.Nw=b.qe(a))};
Ir.prototype.commitLinks=function(){for(var a=this.network.edges.iterator;a.next();)a.value.commit()};function bs(a,b,c,d,e){var f=a.gz;if(.001>Math.abs(a.Fn-1))return void 0!==d&&void 0!==e?e*b:2*Math.PI*b;a=b>c?Math.sqrt(b*b-c*c)/b:Math.sqrt(c*c-b*b)/c;var g=0;var h=void 0!==d&&void 0!==e?e/(f+1):Math.PI/(2*(f+1));for(var k=0,l=0;l<=f;l++){void 0!==d&&void 0!==e?k=d+l*e/f:k=l*Math.PI/(2*f);var m=Math.sin(k);g+=Math.sqrt(1-a*a*m*m)*h}return void 0!==d&&void 0!==e?(b>c?b:c)*g:4*(b>c?b:c)*g}
function as(a,b,c,d,e){return b/(void 0!==d&&void 0!==e?bs(a,1,c,d,e):bs(a,1,c))}function cs(a,b,c,d,e){if(.001>Math.abs(a.Fn-1))return e/b;var f=b>c?Math.sqrt(b*b-c*c)/b:Math.sqrt(c*c-b*b)/c,g=0;a=2*Math.PI/(700*a.network.vertexes.count);b>c&&(d+=Math.PI/2);for(var h=0;;h++){var k=Math.sin(d+h*a);g+=(b>c?b:c)*Math.sqrt(1-f*f*k*k)*a;if(g>=e)return h*a}}
Ir.prototype.sort=function(a){switch(this.sorting){case Qr:break;case Rr:a.reverse();break;case Or:a.sort(this.comparer);break;case Pr:a.sort(this.comparer);a.reverse();break;case Mr:return this.Zs(ls(a));default:v("Invalid sorting type.")}return a};
function ls(a){for(var b=[],c=0;c<a.length;c++)b.push(0);c=new H;for(var d=0;d<a.length;d++){var e=-1,f=-1;if(0===d)for(var g=0;g<a.length;g++){var h=a.M(g).edgesCount;h>e&&(e=h,f=g)}else for(g=0;g<a.length;g++)h=b[g],h>e&&(e=h,f=g);c.add(a.M(f));b[f]=-1;f=a.M(f);for(g=f.sourceEdges;g.next();)e=a.indexOf(g.value.fromVertex),0>e||0<=b[e]&&b[e]++;for(f=f.destinationEdges;f.next();)e=a.indexOf(f.value.toVertex),0>e||0<=b[e]&&b[e]++}return c}
Ir.prototype.Zs=function(a){for(var b=[],c=0;c<a.length;c++){var d=a.M(c);b[c]=[];for(var e,f=d.destinationEdges;f.next();)e=a.indexOf(f.value.toVertex),e!==c&&0>b[c].indexOf(e)&&b[c].push(e);for(d=d.sourceEdges;d.next();)e=a.indexOf(d.value.fromVertex),e!==c&&0>b[c].indexOf(e)&&b[c].push(e)}f=[];for(c=0;c<b.length;c++)f[c]=0;c=[];var g=[],h=[];d=[];e=new H;for(var k=0,l=0;l<b.length;l++){var m=b[l].length;if(1===m)d.push(l);else if(0===m)e.add(a.M(l));else{if(0===k)c.push(l);else{for(var n=m=Infinity,
p=-1,r=[],q=0;q<c.length;q++)0>b[c[q]].indexOf(c[q===c.length-1?0:q+1])&&r.push(q===c.length-1?0:q+1);if(0===r.length)for(q=0;q<c.length;q++)r.push(q);for(q=0;q<r.length;q++){for(var u=r[q],x=b[l],y=0,z=0;z<g.length;z++){var B=f[g[z]],D=f[h[z]];if(B<D){var C=B;B=D}else C=D;if(C<u&&u<=B)for(D=0;D<x.length;D++){var J=x[D];0>c.indexOf(J)||C<f[J]&&f[J]<B||C===f[J]||B===f[J]||y++}else for(D=0;D<x.length;D++)J=x[D],0>c.indexOf(J)||C<f[J]&&f[J]<B&&C!==f[J]&&B!==f[J]&&y++}x=y;for(z=y=0;z<b[l].length;z++)C=
c.indexOf(b[l][z]),0<=C&&(C=Math.abs(u-(C>=u?C+1:C)),y+=C<c.length+1-C?C:c.length+1-C);for(z=0;z<g.length;z++)C=f[g[z]],B=f[h[z]],C>=u&&C++,B>=u&&B++,C>B&&(D=B,B=C,C=D),B-C<(c.length+2)/2===(C<u&&u<=B)&&y++;if(x<m||x===m&&y<n)m=x,n=y,p=u}c.splice(p,0,l);for(m=0;m<c.length;m++)f[c[m]]=m;for(m=0;m<b[l].length;m++)n=b[l][m],0<=c.indexOf(n)&&(g.push(l),h.push(n))}k++}}for(g=c.length;;){f=!0;for(h=0;h<d.length;h++)if(k=d[h],l=b[k][0],m=c.indexOf(l),0<=m){for(p=n=0;p<b[l].length;p++)r=c.indexOf(b[l][p]),
0>r||r===m||(q=r>m?r-m:m-r,n+=r<m!==q>g-q?1:-1);c.splice(0>n?m:m+1,0,k);d.splice(h,1);h--}else f=!1;if(f)break;else c.push(d[0]),d.splice(0,1)}for(b=0;b<c.length;b++)e.add(a.M(c[b]));return e};
na.Object.defineProperties(Ir.prototype,{radius:{configurable:!0,get:function(){return this.fp},set:function(a){this.fp!==a&&(A(a,"number",Ir,"radius"),0<a||isNaN(a))&&(this.fp=a,this.C())}},aspectRatio:{configurable:!0,get:function(){return this.en},set:function(a){this.en!==a&&(A(a,"number",Ir,"aspectRatio"),0<a&&(this.en=a,this.C()))}},startAngle:{configurable:!0,get:function(){return this.Hp},set:function(a){this.Hp!==a&&(A(a,"number",Ir,"startAngle"),
this.Hp=a,this.C())}},sweepAngle:{configurable:!0,get:function(){return this.Yl},set:function(a){this.Yl!==a&&(A(a,"number",Ir,"sweepAngle"),0<a&&360>=a?this.Yl=a:this.Yl=360,this.C())}},arrangement:{configurable:!0,get:function(){return this.Nb},set:function(a){this.Nb!==a&&(db(a,Ir,Ir,"arrangement"),a===Xr||a===Jr||a===Wr||a===Vr)&&(this.Nb=a,this.C())}},direction:{configurable:!0,get:function(){return this.N},set:function(a){this.N!==a&&(db(a,Ir,Ir,"direction"),
a===Lr||a===Ur||a===Sr||a===Tr)&&(this.N=a,this.C())}},sorting:{configurable:!0,get:function(){return this.gd},set:function(a){this.gd!==a&&(db(a,Ir,Ir,"sorting"),a===Qr||a===Rr||a===Or||Pr||a===Mr)&&(this.gd=a,this.C())}},comparer:{configurable:!0,get:function(){return this.Zc},set:function(a){this.Zc!==a&&(A(a,"function",Ir,"comparer"),this.Zc=a,this.C())}},spacing:{configurable:!0,get:function(){return this.wf},set:function(a){this.wf!==a&&(A(a,"number",
Ir,"spacing"),this.wf=a,this.C())}},nodeDiameterFormula:{configurable:!0,get:function(){return this.Po},set:function(a){this.Po!==a&&(db(a,Ir,Ir,"nodeDiameterFormula"),a===Nr||a===Yr)&&(this.Po=a,this.C())}},actualXRadius:{configurable:!0,get:function(){return this.hc}},actualYRadius:{configurable:!0,get:function(){return this.le}},actualSpacing:{configurable:!0,get:function(){return this.rj}},actualCenter:{configurable:!0,get:function(){return this.Nw}}});
var Jr=new F(Ir,"ConstantSpacing",0),Wr=new F(Ir,"ConstantDistance",1),Vr=new F(Ir,"ConstantAngle",2),Xr=new F(Ir,"Packed",3),Lr=new F(Ir,"Clockwise",4),Ur=new F(Ir,"Counterclockwise",5),Sr=new F(Ir,"BidirectionalLeft",6),Tr=new F(Ir,"BidirectionalRight",7),Qr=new F(Ir,"Forwards",8),Rr=new F(Ir,"Reverse",9),Or=new F(Ir,"Ascending",10),Pr=new F(Ir,"Descending",11),Mr=new F(Ir,"Optimized",12),Nr=new F(Ir,"Pythagorean",13),Yr=new F(Ir,"Circular",14);Ir.className="CircularLayout";Ir.ConstantSpacing=Jr;
Ir.ConstantDistance=Wr;Ir.ConstantAngle=Vr;Ir.Packed=Xr;Ir.Clockwise=Lr;Ir.Counterclockwise=Ur;Ir.BidirectionalLeft=Sr;Ir.BidirectionalRight=Tr;Ir.Forwards=Qr;Ir.Reverse=Rr;Ir.Ascending=Or;Ir.Descending=Pr;Ir.Optimized=Mr;Ir.Pythagorean=Nr;Ir.Circular=Yr;function Kr(){this.nm=-Infinity;this.Sm=this.Ck=null}
Kr.prototype.compare=function(a,b){if(0<a&&0>this.nm||Math.abs(a)<Math.abs(this.nm)&&!(0>a&&0<this.nm))for(this.nm=a,this.Ck=[],this.Sm=[],a=0;a<b.length;a++)this.Ck[a]=b[a].bounds.x,this.Sm[a]=b[a].bounds.y};Kr.prototype.commit=function(a){if(null!==this.Ck&&null!==this.Sm)for(var b=0;b<this.Ck.length;b++){var c=a.M(b);c.x=this.Ck[b];c.y=this.Sm[b]}};Kr.className="VertexArrangement";function Zr(a){fq.call(this,a)}ma(Zr,fq);Zr.prototype.createVertex=function(){return new ms(this)};
Zr.prototype.createEdge=function(){return new ns(this)};Zr.className="CircularNetwork";function ms(a){tq.call(this,a);this.F=this.qj=NaN}ma(ms,tq);
function $r(a,b){var c=a.network;if(null===c)return NaN;c=c.layout;if(null===c)return NaN;if(c.arrangement===Xr)if(c.nodeDiameterFormula===Yr)a.qj=Math.max(a.width,a.height);else{c=Math.abs(Math.sin(b));b=Math.abs(Math.cos(b));if(0===c)return a.width;if(0===b)return a.height;a.qj=Math.min(a.height/c,a.width/b)}else a.qj=c.nodeDiameterFormula===Yr?Math.max(a.width,a.height):Math.sqrt(a.width*a.width+a.height*a.height);return a.qj}
na.Object.defineProperties(ms.prototype,{diameter:{configurable:!0,get:function(){return this.qj},set:function(a){this.qj!==a&&(A(a,"number",ms,"diameter"),this.qj=a)}},actualAngle:{configurable:!0,get:function(){return this.F},set:function(a){this.F!==a&&(A(a,"number",ms,"actualAngle"),this.F=a)}}});ms.className="CircularVertex";function ns(a){uq.call(this,a)}ma(ns,uq);ns.className="CircularEdge";
function os(a){zi.call(this);this.Hh=null;this.qo=0;this.Wd=(new Hb(100,100)).freeze();this.dn=!1;this.vf=!0;this.qd=!1;this.Al=100;this.In=1;this.eg=1E3;this.Ko=10;this.gp=Math;this.$k=.05;this.Zk=50;this.Xk=150;this.Yk=0;this.An=10;this.zn=5;a&&Object.assign(this,a)}ma(os,zi);
os.prototype.cloneProtected=function(a){zi.prototype.cloneProtected.call(this,a);a.Wd.assign(this.Wd);a.dn=this.dn;a.vf=this.vf;a.qd=this.qd;a.Al=this.Al;a.In=this.In;a.eg=this.eg;a.Ko=this.Ko;a.gp=this.gp;a.$k=this.$k;a.Zk=this.Zk;a.Xk=this.Xk;a.Yk=this.Yk;a.An=this.An;a.zn=this.zn};
os.prototype.serializeLayoutProperties=function(a,b){zi.prototype.serializeLayoutProperties.call(this,a,b);a.arrangementSpacing={width:this.arrangementSpacing.width,height:this.arrangementSpacing.height};a.arrangesToOrigin=this.arrangesToOrigin;a.setsPortSpots=this.setsPortSpots;a.comments=this.comments;a.maxIterations=this.maxIterations;a.epsilonDistance=this.epsilonDistance;a.infinityDistance=this.infinityDistance;a.moveLimit=this.moveLimit;a.defaultSpringStiffness=this.defaultSpringStiffness;a.defaultSpringLength=
this.defaultSpringLength;a.defaultElectricalCharge=this.defaultElectricalCharge;a.defaultGravitationalMass=this.defaultGravitationalMass;a.defaultCommentSpringLength=this.defaultCommentSpringLength;a.defaultCommentElectricalCharge=this.defaultCommentElectricalCharge};
os.prototype.deserializeLayoutProperties=function(a,b,c,d,e){zi.prototype.deserializeLayoutProperties.call(this,a,b,c,d,e);this.arrangementSpacing=new Hb(a.arrangementSpacing.width,a.arrangementSpacing.height);this.arrangesToOrigin=a.arrangesToOrigin;this.setsPortSpots=a.setsPortSpots;this.comments=a.comments;this.maxIterations=a.maxIterations;this.epsilonDistance=a.epsilonDistance;this.infinityDistance=a.infinityDistance;this.moveLimit=a.moveLimit;this.defaultSpringStiffness=a.defaultSpringStiffness;
this.defaultSpringLength=a.defaultSpringLength;this.defaultElectricalCharge=a.defaultElectricalCharge;this.defaultGravitationalMass=a.defaultGravitationalMass;this.defaultCommentSpringLength=a.defaultCommentSpringLength;this.defaultCommentElectricalCharge=a.defaultCommentElectricalCharge};os.prototype.createNetwork=function(){return new ps(this)};
os.prototype.doLayout=function(a){G&&null===a&&v("Layout.doLayout(collection) argument must not be null but a Diagram, a Group, or an Iterable of Parts");null===this.network&&(this.network=this.makeNetwork(a));if(!this.jw()){a=this.maxIterations;if(0<this.network.vertexes.count){this.network.fq();for(var b=this.network.vertexes.iterator;b.next();){var c=b.value;c.charge=this.electricalCharge(c);c.mass=this.gravitationalMass(c)}for(b=this.network.edges.iterator;b.next();)c=b.value,c.stiffness=this.springStiffness(c),
c.length=this.springLength(c);this.Iu();this.qo=0;if(this.needsClusterLayout()){b=this.network;c=b.Qy();for(var d=c.iterator;d.next();){this.network=d.value;for(var e=this.network.vertexes.iterator;e.next();){var f=e.value;f.Qd=f.vertexes.count;f.Vh=1;f.bk=null;f.Ze=null}qs(this,0,a)}this.network=b;var g=d=c.iterator;G&&w(b,ps,os,"arrangeConnectedGraphs:singletons");d=this.arrangementSpacing;var h=g.count,k=!0;f=e=0;for(var l=Na(),m=0;m<h+b.vertexes.count+2;m++)l[m]=null;h=0;g.reset();for(var n=M.alloc();g.next();)if(m=
g.value,this.computeBounds(m,n),k)k=!1,e=n.x+n.width/2,f=n.y+n.height/2,l[0]=new K(n.x+n.width+d.width,n.y),l[1]=new K(n.x,n.y+n.height+d.height),h=2;else{var p=rs(l,h,e,f,n.width,n.height,d),r=l[p],q=new K(r.x+n.width+d.width,r.y),u=new K(r.x,r.y+n.height+d.height);p+1<h&&l.splice(p+1,0,null);l[p]=q;l[p+1]=u;h++;p=r.x-n.x;r=r.y-n.y;for(m=m.vertexes.iterator;m.next();)q=m.value,q.centerX+=p,q.centerY+=r}M.free(n);for(m=b.vertexes.iterator;m.next();)g=m.value,p=g.bounds,2>h?(e=p.x+p.width/2,f=p.y+
p.height/2,l[0]=new K(p.x+p.width+d.width,p.y),l[1]=new K(p.x,p.y+p.height+d.height),h=2):(k=rs(l,h,e,f,p.width,p.height,d),n=l[k],r=new K(n.x+p.width+d.width,n.y),p=new K(n.x,n.y+p.height+d.height),k+1<h&&l.splice(k+1,0,null),l[k]=r,l[k+1]=p,h++,g.centerX=n.x+g.width/2,g.centerY=n.y+g.height/2);Pa(l);for(d=c.iterator;d.next();){c=d.value;for(e=c.vertexes.iterator;e.next();)b.zg(e.value);for(c=c.edges.iterator;c.next();)b.dm(c.value)}}ss(this,a);this.updateParts()}this.Al=a;this.network=null;this.isValidLayout=
!0}};os.prototype.needsClusterLayout=function(){if(3>this.network.vertexes.count)return!1;for(var a=0,b=0,c=this.network.vertexes.first().bounds,d=this.network.vertexes.iterator;d.next();){if(d.value.bounds.Sc(c)&&(a++,2<a))return!0;if(10<b)break;b++}return!1};os.prototype.computeBounds=function(a,b){var c=!0;for(a=a.vertexes.iterator;a.next();){var d=a.value;c?(c=!1,b.set(d.bounds)):b.Xc(d.bounds)}return b};
function ts(a,b,c){G&&(E(b,os,"computeClusterLayoutIterations:level"),E(c,os,"computeClusterLayoutIterations:maxiter"));return Math.max(Math.min(a.network.vertexes.count,c*(b+1)/11),10)}
function qs(a,b,c){G&&(E(b,os,"layoutClusters:level"),E(c,os,"layoutClusters:maxiter"));if(us(a,b)){var d=a.eg;a.eg*=1+1/(b+1);var e=vs(a,b),f=Math.max(0,ts(a,b,c));a.maxIterations+=f;qs(a,b+1,c);ss(a,f);ws(a,e,b);c=e.vertexes.Fa();c.sort(function(a,b){return null===a||null===b||a===b?0:b.Qd-a.Qd});for(e=0;e<c.length;e++)xs(a,c[e],b);a.eg=d}}
function us(a,b){G&&E(b,os,"hasClusters:level");if(10<b||3>a.network.vertexes.count)return!1;a.Hh=a.network.vertexes.Fa();a=a.Hh;a.sort(function(a,b){return null===a||null===b||a===b?0:b.Qd-a.Qd});for(b=a.length-1;0<=b&&1>=a[b].Qd;)b--;return 1<a.length-b}
function vs(a,b){G&&E(b,os,"pushSubNetwork:level");for(var c=a.network,d=new ps(a),e=0;e<a.Hh.length;e++){var f=a.Hh[e];if(1<f.Qd){d.zg(f);var g=new ys;g.ut=f.Qd;g.yt=f.width;g.tt=f.height;g.sw=f.focus.x;g.tw=f.focus.y;null===f.Ze&&(f.Ze=new H);f.Ze.add(g);f.Sv=f.Ze.count-1}else break}for(f=c.edges.iterator;f.next();){var h=f.value;e=h.fromVertex;g=h.toVertex;e.network===d&&g.network===d?d.dm(h):e.network===d?(h=e.bk,null===h&&(h=new H,e.bk=h),h.add(g),e.Qd--,e.Vh+=g.Vh):g.network===d&&(h=g.bk,null===
h&&(h=new H,g.bk=h),h.add(e),g.Qd--,g.Vh+=e.Vh)}for(e=d.edges.iterator;e.next();)f=e.value,f.length*=Math.max(1,L.sqrt((f.fromVertex.Vh+f.toVertex.Vh)/(4*b+1)));for(b=d.vertexes.iterator;b.next();){e=b.value;var k=e.bk;if(null!==k&&0<k.count&&(g=e.Ze.M(e.Ze.count-1).ut-e.Qd,!(0>=g))){for(var l=h=0,m=k.count-g;m<k.count;m++){var n=k.M(m),p=null;for(f=n.edges.iterator;f.next();){var r=f.value;if(r.my(n)===e){p=r;break}}null!==p&&(l+=p.length,h+=n.width*n.height)}f=e.centerX;k=e.centerY;m=e.width;n=
e.height;p=e.focus;r=m*n;1>r&&(r=1);h=L.sqrt((h+r+l*l*4/(g*g))/r);g=(h-1)*m/2;h=(h-1)*n/2;e.bounds=new M(f-p.x-g,k-p.y-h,m+2*g,n+2*h);e.focus=new K(p.x+g,p.y+h)}}a.network=d;return c}
function ws(a,b,c){G&&(w(b,ps,os,"popNetwork:oldnet"),E(c,os,"popNetwork:level"));for(c=a.network.vertexes.iterator;c.next();){var d=c.value;d.network=b;if(null!==d.Ze){var e=d.Ze.M(d.Sv);d.Qd=e.ut;var f=e.sw,g=e.tw;d.bounds=new M(d.centerX-f,d.centerY-g,e.yt,e.tt);d.focus=new K(f,g);d.Sv--}}for(c=a.network.edges.iterator;c.next();)c.value.network=b;a.network=b}
function xs(a,b,c){G&&(w(b,zs,os,"surroundNode:oldnet"),E(c,os,"surroundNode:level"));var d=b.bk;if(null!==d&&0!==d.count){c=b.centerX;var e=b.centerY,f=b.width,g=b.height;null!==b.Ze&&0<b.Ze.count&&(g=b.Ze.M(0),f=g.yt,g=g.tt);f=L.sqrt(f*f+g*g)/2;for(var h=!1,k=g=0,l=0,m=b.vertexes.iterator;m.next();){var n=m.value;1>=n.Qd?k++:(h=!0,l++,g+=Math.atan2(b.centerY-n.centerY,b.centerX-n.centerX))}if(0!==k)for(0<l&&(g/=l),l=b=0,b=h?2*Math.PI/(k+1):2*Math.PI/k,0===k%2&&(l=b/2),1<d.count&&d.sort(function(a,
b){return null===a||null===b||a===b?0:b.width*b.height-a.width*a.height}),h=0===k%2?0:1,d=d.iterator;d.next();)if(k=d.value,!(1<k.Qd||a.isFixed(k))){m=null;for(n=k.edges.iterator;n.next();){m=n.value;break}n=k.width;var p=k.height;n=L.sqrt(n*n+p*p)/2;m=f+m.length+n;n=g+(b*(h/2>>1)+l)*(0===h%2?1:-1);k.centerX=c+m*Math.cos(n);k.centerY=e+m*Math.sin(n);h++}}}
function rs(a,b,c,d,e,f,g){var h=9E19,k=-1,l=0;a:for(;l<b;l++){var m=a[l],n=m.x-c,p=m.y-d;n=n*n+p*p;if(n<h){for(p=l-1;0<=p;p--)if(a[p].y>m.y&&a[p].x-m.x<e+g.width)continue a;for(p=l+1;p<b;p++)if(a[p].x>m.x&&a[p].y-m.y<f+g.height)continue a;k=l;h=n}}return k}os.prototype.Iu=function(){if(this.comments)for(var a=this.network.vertexes.iterator;a.next();)this.addComments(a.value)};
os.prototype.addComments=function(a){var b=a.node;if(null!==b)for(b=b.bv();b.next();){var c=b.value;if("Comment"===c.category&&c.isVisible()){var d=this.network.Ui(c);null===d&&(d=this.network.Zj(c));d.charge=this.defaultCommentElectricalCharge;c=null;for(var e=d.destinationEdges;e.next();){var f=e.value;if(f.toVertex===a){c=f;break}}if(null===c)for(e=d.sourceEdges;e.next();)if(f=e.value,f.fromVertex===a){c=f;break}null===c&&(c=this.network.qk(a,d,null));c.length=this.defaultCommentSpringLength}}};
function As(a,b){G&&(w(a,zs,os,"getNodeDistance:vertexA"),w(b,zs,os,"getNodeDistance:vertexB"));var c=a.bounds,d=c.x;a=c.y;var e=c.width;c=c.height;var f=b.bounds,g=f.x;b=f.y;var h=f.width;f=f.height;return d+e<g?a>b+f?(c=d+e-g,a=a-b-f,L.sqrt(c*c+a*a)):a+c<b?(d=d+e-g,a=a+c-b,L.sqrt(d*d+a*a)):g-(d+e):d>g+h?a>b+f?(c=d-g-h,a=a-b-f,L.sqrt(c*c+a*a)):a+c<b?(d=d-g-h,a=a+c-b,L.sqrt(d*d+a*a)):d-(g+h):a>b+f?a-(b+f):a+c<b?b-(a+c):.1}
function ss(a,b){G&&E(b,os,"performIterations:num");a.Hh=null;for(b=a.qo+b;a.qo<b&&(a.qo++,Bs(a)););a.Hh=null}
function Bs(a){null===a.Hh&&(a.Hh=a.network.vertexes.Fa());var b=a.Hh;if(0>=b.length)return!1;var c=b[0];c.forceX=0;c.forceY=0;for(var d=c.centerX,e=d,f=c=c.centerY,g=1;g<b.length;g++){var h=b[g];h.forceX=0;h.forceY=0;var k=h.centerX;h=h.centerY;d=Math.min(d,k);e=Math.max(e,k);c=Math.min(c,h);f=Math.max(f,h)}(e=e-d>f-c)?b.sort(function(a,b){return null===a||null===b||a===b?0:a.centerX-b.centerX}):b.sort(function(a,b){return null===a||null===b||a===b?0:a.centerY-b.centerY});c=a.eg;var l=d=h=0;for(f=
0;f<b.length;f++){g=b[f];d=g.bounds;h=g.focus;k=d.x+h.x;var m=d.y+h.y;d=g.charge*a.electricalFieldX(k,m);l=g.charge*a.electricalFieldY(k,m);d+=g.mass*a.gravitationalFieldX(k,m);l+=g.mass*a.gravitationalFieldY(k,m);g.forceX+=d;g.forceY+=l;for(var n=f+1;n<b.length;n++){var p=b[n];if(p!==g){d=p.bounds;h=p.focus;l=d.x+h.x;var r=d.y+h.y;if(k-l>c||l-k>c){if(e)break}else if(m-r>c||r-m>c){if(!e)break}else{var q=As(g,p);1>q?(d=a.randomNumberGenerator,null===d&&(a.randomNumberGenerator=d=new Cs),q=d.random(),
h=d.random(),k>l?(d=Math.abs(p.bounds.right-g.bounds.x),d=(1+d)*q):k<l?(d=Math.abs(p.bounds.x-g.bounds.right),d=-(1+d)*q):(d=Math.max(p.width,g.width),d=(1+d)*q-d/2),m>r?(l=Math.abs(p.bounds.bottom-g.bounds.y),l=(1+l)*h):k<l?(l=Math.abs(p.bounds.y-g.bounds.bottom),l=-(1+l)*h):(l=Math.max(p.height,g.height),l=(1+l)*h-l/2)):(h=-(g.charge*p.charge)/(q*q),d=(l-k)/q*h,l=(r-m)/q*h);g.forceX+=d;g.forceY+=l;p.forceX-=d;p.forceY-=l}}}}for(e=a.network.edges.iterator;e.next();)h=e.value,c=h.fromVertex,f=h.toVertex,
g=c.bounds,k=c.focus,d=g.x+k.x,g=g.y+k.y,m=f.bounds,n=f.focus,k=m.x+n.x,m=m.y+n.y,n=As(c,f),1>n?(n=a.randomNumberGenerator,null===n&&(a.randomNumberGenerator=n=new Cs),h=n.random(),n=n.random(),d=(d>k?1:-1)*(1+(f.width>c.width?f.width:c.width))*h,l=(g>m?1:-1)*(1+(f.height>c.height?f.height:c.height))*n):(h=h.stiffness*(n-h.length),d=(k-d)/n*h,l=(m-g)/n*h),c.forceX+=d,c.forceY+=l,f.forceX-=d,f.forceY-=l;for(e=d=0;e<b.length;e++)c=b[e],a.isFixed(c)?a.moveFixedVertex(c):d=Math.max(d,a.moveVertex(c)||
0);return d>a.epsilonDistance*a.epsilonDistance}os.prototype.moveVertex=function(a){var b=a.forceX,c=a.forceY,d=this.moveLimit;b<-d?b=-d:b>d&&(b=d);c<-d?c=-d:c>d&&(c=d);a.centerX+=b;a.centerY+=c;return b*b+c*c};os.prototype.moveFixedVertex=function(){};os.prototype.commitLayout=function(){this.Wv();this.commitNodes();this.isRouting&&this.commitLinks()};
os.prototype.Wv=function(){if(this.setsPortSpots)for(var a=this.network.edges.iterator;a.next();){var b=a.value.link;null!==b&&(b.fromSpot=dd,b.toSpot=dd)}};os.prototype.commitNodes=function(){var a=0,b=0;if(this.arrangesToOrigin){var c=M.alloc();this.computeBounds(this.network,c);b=this.arrangementOrigin;a=b.x-c.x;b=b.y-c.y;M.free(c)}c=M.alloc();for(var d=this.network.vertexes.iterator;d.next();){var e=d.value;if(0!==a||0!==b)c.assign(e.bounds),c.x+=a,c.y+=b,e.bounds=c;e.commit()}M.free(c)};
os.prototype.commitLinks=function(){for(var a=this.network.edges.iterator;a.next();)a.value.commit()};os.prototype.springStiffness=function(a){a=a.stiffness;return isNaN(a)?this.$k:a};os.prototype.springLength=function(a){a=a.length;return isNaN(a)?this.Zk:a};os.prototype.electricalCharge=function(a){a=a.charge;return isNaN(a)?this.Xk:a};os.prototype.electricalFieldX=function(){return 0};os.prototype.electricalFieldY=function(){return 0};
os.prototype.gravitationalMass=function(a){a=a.mass;return isNaN(a)?this.Yk:a};os.prototype.gravitationalFieldX=function(){return 0};os.prototype.gravitationalFieldY=function(){return 0};os.prototype.isFixed=function(a){return a.isFixed};
na.Object.defineProperties(os.prototype,{currentIteration:{configurable:!0,get:function(){return this.qo}},arrangementSpacing:{configurable:!0,get:function(){return this.Wd},set:function(a){w(a,Hb,os,"arrangementSpacing");this.Wd.B(a)||(this.Wd.assign(a),this.C())}},arrangesToOrigin:{configurable:!0,get:function(){return this.dn},set:function(a){this.dn!==a&&(A(a,"boolean",os,"arrangesToOrigin"),this.dn=a,this.C())}},setsPortSpots:{configurable:!0,
get:function(){return this.vf},set:function(a){this.vf!==a&&(A(a,"boolean",os,"setsPortSpots"),this.vf=a,this.C())}},comments:{configurable:!0,get:function(){return this.qd},set:function(a){this.qd!==a&&(A(a,"boolean",os,"comments"),this.qd=a,this.C())}},maxIterations:{configurable:!0,get:function(){return this.Al},set:function(a){this.Al!==a&&(A(a,"number",os,"maxIterations"),0<=a&&(this.Al=a,this.C()))}},epsilonDistance:{configurable:!0,get:function(){return this.In},
set:function(a){this.In!==a&&(A(a,"number",os,"epsilonDistance"),0<a&&(this.In=a,this.C()))}},infinityDistance:{configurable:!0,get:function(){return this.eg},set:function(a){this.eg!==a&&(A(a,"number",os,"infinityDistance"),1<a&&(this.eg=a,this.C()))}},moveLimit:{configurable:!0,get:function(){return this.Ko},set:function(a){this.Ko!==a&&(A(a,"number",os,"moveLimit"),1<a&&(this.Ko=a,this.C()))}},randomNumberGenerator:{configurable:!0,get:function(){return this.gp},
set:function(a){this.gp!==a&&(null!==a&&"function"!==typeof a.random&&v('ForceDirectedLayout.randomNumberGenerator must have a "random()" function on it: '+a),this.gp=a)}},defaultSpringStiffness:{configurable:!0,get:function(){return this.$k},set:function(a){this.$k!==a&&(A(a,"number",os,"defaultSpringStiffness"),this.$k=a,this.C())}},defaultSpringLength:{configurable:!0,get:function(){return this.Zk},set:function(a){this.Zk!==a&&(A(a,"number",os,"defaultSpringLength"),
this.Zk=a,this.C())}},defaultElectricalCharge:{configurable:!0,get:function(){return this.Xk},set:function(a){this.Xk!==a&&(A(a,"number",os,"defaultElectricalCharge"),this.Xk=a,this.C())}},defaultGravitationalMass:{configurable:!0,get:function(){return this.Yk},set:function(a){this.Yk!==a&&(A(a,"number",os,"defaultGravitationalMass"),this.Yk=a,this.C())}},defaultCommentSpringLength:{configurable:!0,get:function(){return this.An},set:function(a){this.An!==
a&&(A(a,"number",os,"defaultCommentSpringLength"),this.An=a,this.C())}},defaultCommentElectricalCharge:{configurable:!0,get:function(){return this.zn},set:function(a){this.zn!==a&&(A(a,"number",os,"defaultCommentElectricalCharge"),this.zn=a,this.C())}}});os.className="ForceDirectedLayout";function ys(){this.tw=this.sw=this.tt=this.yt=this.ut=0}ys.className="ForceDirectedSubnet";function ps(a){fq.call(this,a)}ma(ps,fq);ps.prototype.createVertex=function(){return new zs(this)};
ps.prototype.createEdge=function(){return new Ds(this)};ps.className="ForceDirectedNetwork";function zs(a){tq.call(this,a);this.Ha=!1;this.Ra=this.F=NaN;this.Vh=this.Qd=this.Da=this.O=0;this.Ze=this.bk=null;this.Sv=0}ma(zs,tq);zs.prototype.serializeVertexProperties=function(a,b){tq.prototype.serializeVertexProperties.call(this,a,b);a.isFixed=this.isFixed;a.charge=this.charge;a.mass=this.mass};
zs.prototype.deserializeVertexProperties=function(a,b,c,d){tq.prototype.deserializeVertexProperties.call(this,a,b,c,d);this.isFixed=a.isFixed;this.charge=a.charge;this.mass=a.mass};
na.Object.defineProperties(zs.prototype,{isFixed:{configurable:!0,get:function(){return this.Ha},set:function(a){this.Ha!==a&&(A(a,"boolean",zs,"isFixed"),this.Ha=a)}},charge:{configurable:!0,get:function(){return this.F},set:function(a){this.F!==a&&(A(a,"number",zs,"charge"),this.F=a)}},mass:{configurable:!0,get:function(){return this.Ra},set:function(a){this.Ra!==a&&(A(a,"number",zs,"mass"),this.Ra=a)}},forceX:{configurable:!0,get:function(){return this.O},
set:function(a){this.O!==a&&(A(a,"number",zs,"forceX"),this.O=a)}},forceY:{configurable:!0,get:function(){return this.Da},set:function(a){this.Da!==a&&(A(a,"number",zs,"forceY"),this.Da=a)}}});zs.className="ForceDirectedVertex";function Ds(a){uq.call(this,a);this.j=this.o=NaN}ma(Ds,uq);Ds.prototype.serializeEdgeProperties=function(a,b){uq.prototype.serializeEdgeProperties.call(this,a,b);a.stiffness=this.stiffness;a.length=this.length};
Ds.prototype.deserializeEdgeProperties=function(a,b,c,d){uq.prototype.deserializeEdgeProperties.call(this,a,b,c,d);this.stiffness=a.stiffness;this.length=a.length};na.Object.defineProperties(Ds.prototype,{stiffness:{configurable:!0,get:function(){return this.o},set:function(a){this.o!==a&&(A(a,"number",Ds,"stiffness"),this.o=a)}},length:{configurable:!0,get:function(){return this.j},set:function(a){this.j!==a&&(A(a,"number",Ds,"length"),this.j=a)}}});Ds.className="ForceDirectedEdge";
function Cs(){var a=0;void 0===a&&(a=42);this.seed=a;this.Sy=48271;this.Uy=2147483647;this.Q=44488.07041494893;this.Vy=3399;this.Ty=1/2147483647;this.random()}Cs.prototype.random=function(){var a=this.seed%this.Q*this.Sy-this.seed/this.Q*this.Vy;0<a?this.seed=a:this.seed=a+this.Uy;return this.seed*this.Ty};Cs.className="RandomNumberGenerator";
function Es(a){zi.call(this);this.gc=this.he=25;this.N=0;this.Wk=Fs;this.vl=Gs;this.ll=Hs;this.Cj=4;this.Hk=Is;this.mg=15;this.vf=!0;this.wo=4;this.Ja=this.vi=this.xa=-1;this.zc=this.hh=0;this.Pa=this.Dd=this.Ed=this.ge=this.Fb=null;this.oh=0;this.Lo=this.Jj=null;this.Lc=0;this.Mo=null;this.Yc=new K;this.Je=[];this.Je.length=100;a&&Object.assign(this,a)}ma(Es,zi);
Es.prototype.cloneProtected=function(a){zi.prototype.cloneProtected.call(this,a);a.he=this.he;a.gc=this.gc;a.N=this.N;a.Wk=this.Wk;a.vl=this.vl;a.ll=this.ll;a.Cj=this.Cj;a.Hk=this.Hk;a.mg=this.mg;a.vf=this.vf;a.wo=this.wo};
Es.prototype.serializeLayoutProperties=function(a,b){zi.prototype.serializeLayoutProperties.call(this,a,b);a.layerSpacing=this.layerSpacing;a.columnSpacing=this.columnSpacing;a.direction=this.direction;a.cycleRemoveOption=this.cycleRemoveOption.name;a.layeringOption=this.layeringOption.name;a.initializeOption=this.initializeOption.name;a.iterations=this.iterations;a.aggressiveOption=this.aggressiveOption.name;a.packOption=this.packOption;a.setsPortSpots=this.setsPortSpots;a.linkSpacing=this.linkSpacing;
a.xa=this.xa;a.vi=this.vi;a.Ja=this.Ja;a.hh=this.hh;a.zc=this.zc;a.Fb=this.Fb;a.oh=this.oh;a.Lc=this.Lc;a.Yc={x:this.Yc.x,y:this.Yc.y}};
Es.prototype.deserializeLayoutProperties=function(a,b,c,d,e){zi.prototype.deserializeLayoutProperties.call(this,a,b,c,d,e);this.layerSpacing=a.layerSpacing;this.columnSpacing=a.columnSpacing;this.direction=a.direction;this.cycleRemoveOption=cb(Es,a.cycleRemoveOption);this.layeringOption=cb(Es,a.layeringOption);this.initializeOption=cb(Es,a.initializeOption);this.iterations=a.iterations;this.aggressiveOption=cb(Es,a.aggressiveOption);this.packOption=a.packOption;this.setsPortSpots=a.setsPortSpots;
this.linkSpacing=a.linkSpacing;this.xa=a.xa;this.vi=a.vi;this.Ja=a.Ja;this.hh=a.hh;this.zc=a.zc;this.Fb=a.Fb;this.oh=a.oh;this.Lc=a.Lc;this.Yc=new K(this.Yc.x,this.Yc.y);e&&!d&&e.edges.each(function(a){if(!a.link&&a.fromVertex&&a.toVertex&&(null===a.fromVertex.node||null===a.toVertex.node)){for(var b=a.fromVertex;null!==b&&null===b.node&&0<b.zd.count;){var c=b.zd.M(0);if(c.link){a.link=c.link;break}b=c.fromVertex}if(!a.link){for(c=a.toVertex;null!==c&&null===c.node&&0<c.Md.count;){var d=c.Md.M(0);
if(d.link){a.link=d.link;break}c=d.toVertex}if(!a.link)for(c=c.zd.iterator;c.next();)if(d=c.value,d.link&&d.fromVertex===b){a.link=d.link;break}}}})};Es.prototype.mb=function(a){a.classType===Es?0===a.name.indexOf("Aggressive")?this.aggressiveOption=a:0===a.name.indexOf("Cycle")?this.cycleRemoveOption=a:0===a.name.indexOf("Init")?this.initializeOption=a:0===a.name.indexOf("Layer")?this.layeringOption=a:v("Unknown enum value: "+a):zi.prototype.mb.call(this,a)};Es.prototype.createNetwork=function(){return new Js(this)};
Es.prototype.doLayout=function(a){G&&null===a&&v("Layout.doLayout(collection) argument must not be null but a Diagram, a Group, or an Iterable of Parts");null===this.network&&(this.network=this.makeNetwork(a));this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);this.vi=-1;this.zc=this.hh=0;this.Mo=this.Lo=this.Jj=null;for(a=0;a<this.Je.length;a++)this.Je[a]=null;if(0<this.network.vertexes.count){this.network.fq();if(this.jw())return;this.cycleRemoveOption!==Ks&&this.removeCycles();for(a=
this.network.vertexes.iterator;a.next();)a.value.layer=-1;this.xa=-1;this.assignLayers();for(a.reset();a.next();)this.xa=Math.max(this.xa,a.value.layer);this.cycleRemoveOption===Ks&&this.removeCycles();a=this.network;for(var b=[],c=a.edges.iterator;c.next();){var d=c.value;d.valid=!1;b.push(d)}for(c=0;c<b.length;c++){d=b[c];var e=d.fromVertex,f=d.toVertex;if(!(d.valid||(null===e.node&&null===e.data||null===f.node&&null===f.data)&&e.layer===f.layer)){var g=0,h=0,k=0,l=0;if(null!==d.link){h=d.link;
if(null===h)continue;var m=e.node;g=f.node;if(null===m||null===g)continue;var n=h.fromNode;k=h.toNode;var p=h.fromPort;h=h.toPort;if(d.rev){l=n;var r=p;n=k;p=h;k=l;h=r}var q=e.focus;l=f.focus;var u=d.rev?f.bounds:e.bounds;r=K.alloc();m!==n?u.s()&&n.isVisible()?n.actualBounds.s()?(Jo(n,p,Ic,r),r.x+=n.actualBounds.x-u.x,r.y+=n.actualBounds.y-u.y):(Jo(n,p,Ic,r),r.s()||r.assign(q)):r.assign(q):u.s()?(Jo(n,p,Ic,r),r.s()||r.assign(q)):r.assign(q);n=d.rev?e.bounds:f.bounds;m=K.alloc();g!==k?n.s()&&k.isVisible()?
k.actualBounds.s()?(Jo(k,h,Ic,m),m.x+=k.actualBounds.x-n.x,m.y+=k.actualBounds.y-n.y):(Jo(k,h,Ic,m),m.s()||m.assign(l)):m.assign(l):n.s()?(Jo(k,h,Ic,m),m.s()||m.assign(l)):m.assign(l);90===this.N||270===this.N?(g=Math.round((r.x-q.x)/this.gc),k=r.x,h=Math.round((m.x-l.x)/this.gc),l=m.x):(g=Math.round((r.y-q.y)/this.gc),k=r.y,h=Math.round((m.y-l.y)/this.gc),l=m.y);K.free(r);K.free(m);d.portFromColOffset=g;d.portFromPos=k;d.portToColOffset=h;d.portToPos=l}else d.portFromColOffset=0,d.portFromPos=0,
d.portToColOffset=0,d.portToPos=0;r=e.layer;m=f.layer;n=0;u=d.link;if(null!==u){var x=u.fromPort,y=u.toPort;if(null!==x&&null!==y){var z=u.fromNode;p=u.toNode;if(null!==z&&null!==p){var B=Ls(this,!0),D=Ls(this,!1),C=this.setsPortSpots?B:u.computeSpot(!0,x);q=this.setsPortSpots?D:u.computeSpot(!1,y);var J=u.isOrthogonal;C.Uc()&&C.Pf(D)&&q.Uc()&&q.Pf(B)?n=0:(B=u.getLinkPoint(z,x,C,!0,J,p,y,K.alloc()),D=u.getLinkDirection(z,x,B,C,!0,J,p,y),K.free(B),C.sq()||D!==Ms(this,d,!0)?this.setsPortSpots&&null!==
z&&1===z.ports.count&&d.rev&&(n+=1):n+=1,C=u.getLinkPoint(p,y,q,!1,J,z,x,K.alloc()),u=u.getLinkDirection(p,y,C,q,!1,J,z,x),K.free(C),q.sq()||u!==Ms(this,d,!1)?this.setsPortSpots&&null!==p&&1===p.ports.count&&d.rev&&(n+=2):n+=2)}}}p=n;n=1===p||3===p?!0:!1;if(p=2===p||3===p?!0:!1)q=a.createVertex(),q.node=null,q.Gf=1,q.layer=r,q.near=e,a.zg(q),e=a.qk(e,q,d.link),e.valid=!1,e.rev=d.rev,e.portFromColOffset=g,e.portToColOffset=0,e.portFromPos=k,e.portToPos=0,e=q;u=1;n&&u--;if(r-m>u&&0<r){d.valid=!1;q=
a.createVertex();q.node=null;q.Gf=2;q.layer=r-1;a.zg(q);e=a.qk(e,q,d.link);e.valid=!0;e.rev=d.rev;e.portFromColOffset=p?0:g;e.portToColOffset=0;e.portFromPos=p?0:k;e.portToPos=0;e=q;for(r--;r-m>u&&0<r;)q=a.createVertex(),q.node=null,q.Gf=3,q.layer=r-1,a.zg(q),e=a.qk(e,q,d.link),e.valid=!0,e.rev=d.rev,e.portFromColOffset=0,e.portToColOffset=0,e.portFromPos=0,e.portToPos=0,e=q,r--;e=a.qk(q,f,d.link);e.valid=!n;n&&(q.near=f);e.rev=d.rev;e.portFromColOffset=0;e.portToColOffset=h;e.portFromPos=0;e.portToPos=
l}else d.valid=!0}}a=this.Fb=[];for(b=0;b<=this.xa;b++)a[b]=0;for(b=this.network.vertexes.iterator;b.next();)b.value.index=-1;this.initializeIndices();this.vi=-1;for(c=this.zc=this.hh=0;c<=this.xa;c++)a[c]>a[this.zc]&&(this.vi=a[c]-1,this.zc=c),a[c]<a[this.hh]&&(this.hh=c);this.Mo=[];for(c=0;c<a.length;c++)this.Mo[c]=[];for(b.reset();b.next();)a=b.value,this.Mo[a.layer][a.index]=a;this.Ja=-1;for(a=0;a<=this.xa;a++){b=Ns(this,a);c=0;d=this.Fb[a];for(f=0;f<d;f++)e=b[f],c+=this.nodeMinColumnSpace(e,
!0),e.column=c,c+=1,c+=this.nodeMinColumnSpace(e,!1);this.Ja=Math.max(this.Ja,c-1);Os(this,a,b)}this.reduceCrossings();this.straightenAndPack();this.updateParts()}this.network=null;this.isValidLayout=!0};Es.prototype.linkMinLength=function(){return 1};function Ps(a){var b=a.fromVertex.node||a.fromVertex.data;a=a.toVertex.node||a.toVertex.data;return null===b&&null===a?8:null===b||null===a?4:1}
Es.prototype.nodeMinLayerSpace=function(a,b){return null===a.node&&null===a.data?0:90===this.N||270===this.N?b?a.focus.y+10:a.bounds.height-a.focus.y+10:b?a.focus.x+10:a.bounds.width-a.focus.x+10};Es.prototype.nodeMinColumnSpace=function(a,b){if(null===a.node&&null===a.data)return 0;var c=b?a.uk:a.tk;if(null!==c)return c;c=this.N;return 90===c||270===c?b?a.uk=a.focus.x/this.gc+1|0:a.tk=(a.bounds.width-a.focus.x)/this.gc+1|0:b?a.uk=a.focus.y/this.gc+1|0:a.tk=(a.bounds.height-a.focus.y)/this.gc+1|0};
function Qs(a){null===a.Jj&&(a.Jj=[]);for(var b=0,c=a.network.vertexes.iterator;c.next();){var d=c.value;a.Jj[b]=d.layer;b++;a.Jj[b]=d.column;b++;a.Jj[b]=d.index;b++}return a.Jj}function Rs(a,b){var c=0;for(a=a.network.vertexes.iterator;a.next();){var d=a.value;d.layer=b[c];c++;d.column=b[c];c++;d.index=b[c];c++}}
function Ss(a,b,c){G&&(E(b,Es,"crossingMatrix:unfixedLayer"),E(c,Es,"crossingMatrix:direction"));var d=Ns(a,b),e=a.Fb[b];if(null===a.Lo||a.Lo.length<e*e)a.Lo=[];for(var f=a.Lo,g=0;g<e;g++){var h=0,k=d[g],l=k.near;if(null!==l&&l.layer===k.layer)if(k=l.index,k>g)for(var m=g+1;m<k;m++){var n=d[m];n.near===l&&n.Gf===l.Gf||h++}else for(m=g-1;m>k;m--)n=d[m],n.near===l&&n.Gf===l.Gf||h++;var p;if(0<=c)for(k=d[g].sourceEdgesArrayAccess,l=0;l<k.length;l++){var r=k[l];if(r.valid&&r.fromVertex.layer!==b)for(n=
r.fromVertex.index,m=r.portToPos,r=r.portFromPos,p=l+1;p<k.length;p++){var q=k[p];if(q.valid&&q.fromVertex.layer!==b){var u=q.fromVertex.index;var x=q.portToPos;q=q.portFromPos;m<x&&(n>u||n===u&&r>q)&&h++;x<m&&(u>n||u===n&&q>r)&&h++}}}if(0>=c)for(k=d[g].destinationEdgesArrayAccess,l=0;l<k.length;l++)if(r=k[l],r.valid&&r.toVertex.layer!==b)for(n=r.toVertex.index,m=r.portToPos,r=r.portFromPos,p=l+1;p<k.length;p++)q=k[p],q.valid&&q.toVertex.layer!==b&&(u=q.toVertex.index,x=q.portToPos,q=q.portFromPos,
r<q&&(n>u||n===u&&m>x)&&h++,q<r&&(u>n||u===n&&x>m)&&h++);f[g*e+g]=h;for(k=g+1;k<e;k++){var y=0,z=0;if(0<=c){h=d[g].sourceEdgesArrayAccess;var B=d[k].sourceEdgesArrayAccess;for(l=0;l<h.length;l++)if(r=h[l],r.valid&&r.fromVertex.layer!==b)for(n=r.fromVertex.index,r=r.portFromPos,p=0;p<B.length;p++)q=B[p],q.valid&&q.fromVertex.layer!==b&&(u=q.fromVertex.index,q=q.portFromPos,(n<u||n===u&&r<q)&&z++,(u<n||u===n&&q<r)&&y++)}if(0>=c)for(h=d[g].destinationEdgesArrayAccess,B=d[k].destinationEdgesArrayAccess,
l=0;l<h.length;l++)if(r=h[l],r.valid&&r.toVertex.layer!==b)for(n=r.toVertex.index,m=r.portToPos,p=0;p<B.length;p++)q=B[p],q.valid&&q.toVertex.layer!==b&&(u=q.toVertex.index,x=q.portToPos,(n<u||n===u&&m<x)&&z++,(u<n||u===n&&x<m)&&y++);f[g*e+k]=y;f[k*e+g]=z}}Os(a,b,d);return f}Es.prototype.countCrossings=function(){for(var a=0,b=0;b<=this.xa;b++)for(var c=Ss(this,b,1),d=this.Fb[b],e=0;e<d;e++)for(var f=e;f<d;f++)a+=c[e*d+f];return a};
function Ts(a){for(var b=0,c=0;c<=a.xa;c++){for(var d=a,e=c,f=Ns(d,e),g=d.Fb[e],h=0,k=0;k<g;k++){var l=f[k].destinationEdgesArrayAccess;if(null!==l)for(var m=0;m<l.length;m++){var n=l[m];if(n.valid&&n.toVertex.layer!==e){var p=n.fromVertex.column+n.portFromColOffset;var r=n.toVertex.column+n.portToColOffset;h+=(Math.abs(p-r)+1)*Ps(n)}}}Os(d,e,f);b+=h}return b}
Es.prototype.normalize=function(){var a=Infinity;this.Ja=-1;for(var b=this.network.vertexes.iterator;b.next();){var c=b.value;a=Math.min(a,c.column-this.nodeMinColumnSpace(c,!0));this.Ja=Math.max(this.Ja,c.column+this.nodeMinColumnSpace(c,!1))}for(b.reset();b.next();)b.value.column-=a;this.Ja-=a};
function Us(a,b,c){G&&(E(b,Es,"barycenters:unfixedLayer"),E(c,Es,"barycenters:direction"));for(var d=Ns(a,b),e=a.Fb[b],f=[],g=0;g<e;g++){var h=d[g],k=null;0>=c&&(k=h.sourceEdgesArrayAccess);var l=null;0<=c&&(l=h.destinationEdgesArrayAccess);var m=0,n=0,p=h.near;null!==p&&p.layer===h.layer&&(m+=p.column-1,n++);if(null!==k)for(p=0;p<k.length;p++){h=k[p];var r=h.fromVertex;h.valid&&!h.rev&&r.layer!==b&&(m+=r.column,n++)}if(null!==l)for(k=0;k<l.length;k++)h=l[k],p=h.toVertex,h.valid&&!h.rev&&p.layer!==
b&&(m+=p.column,n++);f[g]=0===n?-1:m/n}Os(a,b,d);return f}
function Vs(a,b,c){G&&(E(b,Es,"medians:unfixedLayer"),E(c,Es,"medians:direction"));for(var d=Ns(a,b),e=a.Fb[b],f=[],g=0;g<e;g++){var h=d[g],k=null;0>=c&&(k=h.sourceEdgesArrayAccess);var l=null;0<=c&&(l=h.destinationEdgesArrayAccess);var m=0,n=[],p=h.near;null!==p&&p.layer===h.layer&&(n[m]=p.column-1,m++);h=void 0;if(null!==k)for(p=0;p<k.length;p++){h=k[p];var r=h.fromVertex;h.valid&&!h.rev&&r.layer!==b&&(n[m]=r.column+h.portFromColOffset,m++)}if(null!==l)for(k=0;k<l.length;k++)h=l[k],p=h.toVertex,
h.valid&&!h.rev&&p.layer!==b&&(n[m]=p.column+h.portToColOffset,m++);0===m?f[g]=-1:(n.sort(function(a,b){return a-b}),l=m>>1,f[g]=0!==(m&1)?n[l]:n[l-1]+n[l]>>1)}Os(a,b,d);return f}
function Ws(a,b,c,d,e,f){if(b.component===d){b.component=c;if(e)for(var g=b.destinationEdges;g.next();){var h=g.value;var k=h.toVertex;var l=b.layer-k.layer;h=a.linkMinLength(h);l===h&&Ws(a,k,c,d,e,f)}if(f)for(g=b.sourceEdges;g.next();)h=g.value,k=h.fromVertex,l=k.layer-b.layer,h=a.linkMinLength(h),l===h&&Ws(a,k,c,d,e,f)}}
function Xs(a,b,c,d,e,f){if(b.component===d){b.component=c;if(e)for(var g=b.destinationEdges;g.next();)Xs(a,g.value.toVertex,c,d,e,f);if(f)for(b=b.sourceEdges;b.next();)Xs(a,b.value.fromVertex,c,d,e,f)}}
Es.prototype.removeCycles=function(){for(var a=this.network.edges.iterator;a.next();)a.value.rev=!1;switch(this.Wk){default:case Ys:a=this.network;var b=0,c=a.vertexes.count-1,d=[];d.length=c+1;for(var e=a.vertexes.iterator;e.next();)e.value.valid=!0;for(;null!==Zs(a);){for(e=$s(a);null!==e;)d[c]=e,c--,e.valid=!1,e=$s(a);for(e=at(a);null!==e;)d[b]=e,b++,e.valid=!1,e=at(a);e=null;for(var f=0,g=this.network.vertexes.iterator;g.next();){var h=g.value;if(h.valid){for(var k=0,l=h.destinationEdges;l.next();)l.value.toVertex.valid&&
k++;l=0;for(var m=h.sourceEdges;m.next();)m.value.fromVertex.valid&&l++;if(null===e||f<k-l)e=h,f=k-l}}null!==e&&(d[b]=e,b++,e.valid=!1)}for(b=0;b<a.vertexes.count;b++)d[b].index=b;for(d=a.edges.iterator;d.next();)b=d.value,b.fromVertex.index>b.toVertex.index&&(a.Em(b),b.rev=!0);break;case Fs:for(d=this.network.vertexes.iterator;d.next();)a=d.value,a.Ag=-1,a.finish=-1;for(a=this.network.edges.iterator;a.next();)a.value.forest=!1;this.oh=0;for(d.reset();d.next();)b=d.value,0===b.sourceEdges.count&&
bt(this,b);for(d.reset();d.next();)b=d.value,-1===b.Ag&&bt(this,b);for(a.reset();a.next();)d=a.value,d.forest||(b=d.fromVertex,c=b.finish,e=d.toVertex,f=e.finish,e.Ag<b.Ag&&c<f&&(this.network.Em(d),d.rev=!0));break;case Ks:a=this.network;b=a.vertexes.iterator;for(d=Infinity;b.next();)d=Math.min(d,b.value.layer);if(Infinity>d){if(0>d)for(b.reset();b.next();)b.value.layer-=d;d=[];for(b.reset();b.next();)c=b.value,e=d[c.layer],void 0===e?d[c.layer]=[c]:e.push(c);for(c=b=0;c<d.length;c++)if(e=d[c],!e||
0===e.length)b++;else if(0<c)for(f=0;f<e.length;f++)e[f].layer-=b;for(d=a.edges.iterator;d.next();)b=d.value,b.fromVertex.layer<b.toVertex.layer&&(a.Em(b),b.rev=!0)}}};function Zs(a){for(a=a.vertexes.iterator;a.next();){var b=a.value;if(b.valid)return b}return null}function $s(a){for(a=a.vertexes.iterator;a.next();){var b=a.value;if(b.valid){for(var c=!0,d=b.destinationEdges;d.next();)if(d.value.toVertex.valid){c=!1;break}if(c)return b}}return null}
function at(a){for(a=a.vertexes.iterator;a.next();){var b=a.value;if(b.valid){for(var c=!0,d=b.sourceEdges;d.next();)if(d.value.fromVertex.valid){c=!1;break}if(c)return b}}return null}function bt(a,b){b.Ag=a.oh;a.oh++;for(var c=b.destinationEdges;c.next();){var d=c.value,e=d.toVertex;-1===e.Ag&&(d.forest=!0,bt(a,e))}b.finish=a.oh;a.oh++}
Es.prototype.assignLayers=function(){switch(this.vl){case ct:dt(this);break;case et:for(var a,b=this.network.vertexes.iterator;b.next();)a=ft(this,b.value),this.xa=Math.max(a,this.xa);for(b.reset();b.next();)a=b.value,a.layer=this.xa-a.layer;break;default:case Gs:dt(this);for(b=this.network.vertexes.iterator;b.next();)b.value.valid=!1;for(b.reset();b.next();)a=b.value,0===a.sourceEdges.count&&gt(this,a);a=Infinity;for(b.reset();b.next();)a=Math.min(a,b.value.layer);this.xa=-1;for(b.reset();b.next();){var c=
b.value;c.layer-=a;this.xa=Math.max(this.xa,c.layer)}}};function dt(a){for(var b=a.network.vertexes.iterator;b.next();){var c=ht(a,b.value);a.xa=Math.max(c,a.xa)}}function ht(a,b){var c=0;if(-1===b.layer){for(var d=b.destinationEdges;d.next();){var e=d.value,f=e.toVertex;e=a.linkMinLength(e);c=Math.max(c,ht(a,f)+e)}b.layer=c}else c=b.layer;return c}
function ft(a,b){var c=0;if(-1===b.layer){for(var d=b.sourceEdges;d.next();){var e=d.value,f=e.fromVertex;e=a.linkMinLength(e);c=Math.max(c,ft(a,f)+e)}b.layer=c}else c=b.layer;return c}
function gt(a,b){if(!b.valid){b.valid=!0;for(var c=b.destinationEdges;c.next();)gt(a,c.value.toVertex);for(c=a.network.vertexes.iterator;c.next();)c.value.component=-1;for(var d=b.sourceEdgesArrayAccess,e=d.length,f=0;f<e;f++){var g=d[f],h=g.fromVertex,k=g.toVertex;g=a.linkMinLength(g);h.layer-k.layer>g&&Ws(a,h,0,-1,!0,!1)}for(Ws(a,b,1,-1,!0,!0);0!==b.component;){f=0;d=Infinity;h=0;k=null;for(g=a.network.vertexes.iterator;g.next();){var l=g.value;if(1===l.component){var m=0,n=!1,p=l.sourceEdgesArrayAccess;
e=p.length;for(var r=0;r<e;r++){var q=p[r],u=q.fromVertex;m+=1;1!==u.component&&(f+=1,u=u.layer-l.layer,q=a.linkMinLength(q),d=Math.min(d,u-q))}p=l.destinationEdgesArrayAccess;e=p.length;for(r=0;r<e;r++)q=p[r].toVertex,--m,1!==q.component?--f:n=!0;(null===k||m<h)&&!n&&(k=l,h=m)}}if(0<f){for(c.reset();c.next();)e=c.value,1===e.component&&(e.layer+=d);b.component=0}else k.component=0}for(c=a.network.vertexes.iterator;c.next();)c.value.component=-1;for(Ws(a,b,1,-1,!0,!1);0!==b.component;){d=0;e=Infinity;
f=0;h=null;for(k=a.network.vertexes.iterator;k.next();)if(g=k.value,1===g.component){l=0;m=!1;p=g.sourceEdgesArrayAccess;n=p.length;for(r=0;r<n;r++)q=p[r].fromVertex,l+=1,1!==q.component?d+=1:m=!0;p=g.destinationEdgesArrayAccess;n=p.length;for(r=0;r<n;r++)q=p[r],u=q.toVertex,--l,1!==u.component&&(--d,u=g.layer-u.layer,q=a.linkMinLength(q),e=Math.min(e,u-q));(null===h||l>f)&&!m&&(h=g,f=l)}if(0>d){for(c.reset();c.next();)d=c.value,1===d.component&&(d.layer-=e);b.component=0}else h.component=0}}}
function Ms(a,b,c){return 90===a.N?c&&!b.rev||!c&&b.rev?270:90:180===a.N?c&&!b.rev||!c&&b.rev?0:180:270===a.N?c&&!b.rev||!c&&b.rev?90:270:c&&!b.rev||!c&&b.rev?180:0}
Es.prototype.initializeIndices=function(){switch(this.ll){default:case it:for(var a=this.network.vertexes.iterator;a.next();){var b=a.value,c=b.layer;b.index=this.Fb[c];this.Fb[c]++}break;case Hs:a=this.network.vertexes.iterator;for(b=this.xa;0<=b;b--)for(a.reset();a.next();)c=a.value,c.layer===b&&-1===c.index&&jt(this,c);break;case kt:for(a=this.network.vertexes.iterator,b=0;b<=this.xa;b++)for(a.reset();a.next();)c=a.value,c.layer===b&&-1===c.index&&lt(this,c)}};
function jt(a,b){var c=b.layer;b.index=a.Fb[c];a.Fb[c]++;b=b.destinationEdgesArrayAccess;for(c=!0;c;){c=!1;for(var d=0;d<b.length-1;d++){var e=b[d],f=b[d+1];e.portFromColOffset>f.portFromColOffset&&(c=!0,b[d]=f,b[d+1]=e)}}for(c=0;c<b.length;c++)d=b[c],d.valid&&(d=d.toVertex,-1===d.index&&jt(a,d))}
function lt(a,b){var c=b.layer;b.index=a.Fb[c];a.Fb[c]++;b=b.sourceEdgesArrayAccess;for(var d=!0;d;)for(d=!1,c=0;c<b.length-1;c++){var e=b[c],f=b[c+1];e.portToColOffset>f.portToColOffset&&(d=!0,b[c]=f,b[c+1]=e)}for(c=0;c<b.length;c++)d=b[c],d.valid&&(d=d.fromVertex,-1===d.index&&lt(a,d))}
Es.prototype.reduceCrossings=function(){var a=this.countCrossings(),b=Qs(this),c,d;for(c=0;c<this.Cj;c++){for(d=0;d<=this.xa;d++)mt(this,d,1),nt(this,d,1);var e=this.countCrossings();e<a&&(a=e,b=Qs(this));for(d=this.xa;0<=d;d--)mt(this,d,-1),nt(this,d,-1);e=this.countCrossings();e<a&&(a=e,b=Qs(this))}Rs(this,b);for(c=0;c<this.Cj;c++){for(d=0;d<=this.xa;d++)mt(this,d,0),nt(this,d,0);e=this.countCrossings();e<a&&(a=e,b=Qs(this));for(d=this.xa;0<=d;d--)mt(this,d,0),nt(this,d,0);e=this.countCrossings();
e<a&&(a=e,b=Qs(this))}Rs(this,b);var f,g,h;switch(this.Hk){case ot:break;case pt:for(h=a+1;(d=this.countCrossings())<h;)for(h=d,c=this.xa;0<=c;c--)for(g=0;g<=c;g++){for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=nt(this,d,-1)||f;e=this.countCrossings();e>=a?Rs(this,b):(a=e,b=Qs(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=nt(this,d,1)||f;e=this.countCrossings();e>=a?Rs(this,b):(a=e,b=Qs(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=nt(this,d,1)||f;e>=a?Rs(this,b):(a=e,b=Qs(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=
nt(this,d,-1)||f;e>=a?Rs(this,b):(a=e,b=Qs(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=nt(this,d,0)||f;e>=a?Rs(this,b):(a=e,b=Qs(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=nt(this,d,0)||f;e>=a?Rs(this,b):(a=e,b=Qs(this))}break;default:case Is:for(c=this.xa,g=0,h=a+1;(d=this.countCrossings())<h;){h=d;for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=nt(this,d,-1)||f;e=this.countCrossings();e>=a?Rs(this,b):(a=e,b=Qs(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=nt(this,d,1)||f;e=this.countCrossings();e>=a?Rs(this,b):
(a=e,b=Qs(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=nt(this,d,1)||f;e>=a?Rs(this,b):(a=e,b=Qs(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=nt(this,d,-1)||f;e>=a?Rs(this,b):(a=e,b=Qs(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=nt(this,d,0)||f;e>=a?Rs(this,b):(a=e,b=Qs(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=nt(this,d,0)||f;e>=a?Rs(this,b):(a=e,b=Qs(this))}}Rs(this,b)};
function mt(a,b,c){G&&(E(b,Es,"medianBarycenterCrossingReduction:unfixedLayer"),E(c,Es,"medianBarycenterCrossingReduction:direction"));var d=Ns(a,b),e=a.Fb[b],f=Vs(a,b,c),g=Us(a,b,c);for(c=0;c<e;c++)-1===g[c]&&(g[c]=d[c].column),-1===f[c]&&(f[c]=d[c].column);for(var h=!0,k;h;)for(h=!1,c=0;c<e-1;c++)if(f[c+1]<f[c]||f[c+1]===f[c]&&g[c+1]<g[c])h=!0,k=f[c],f[c]=f[c+1],f[c+1]=k,k=g[c],g[c]=g[c+1],g[c+1]=k,k=d[c],d[c]=d[c+1],d[c+1]=k;for(c=f=0;c<e;c++)k=d[c],k.index=c,f+=a.nodeMinColumnSpace(k,!0),k.column=
f,f+=1,f+=a.nodeMinColumnSpace(k,!1);Os(a,b,d)}
function nt(a,b,c){var d=Ns(a,b),e=a.Fb[b];c=Ss(a,b,c);var f;var g=[];for(f=0;f<e;f++)g[f]=-1;var h=[];for(f=0;f<e;f++)h[f]=-1;for(var k=!1,l=!0;l;)for(l=!1,f=0;f<e-1;f++){var m=c[d[f].index*e+d[f+1].index],n=c[d[f+1].index*e+d[f].index],p=0,r=0,q=d[f].column,u=d[f+1].column,x=a.nodeMinColumnSpace(d[f],!0),y=a.nodeMinColumnSpace(d[f],!1),z=a.nodeMinColumnSpace(d[f+1],!0),B=a.nodeMinColumnSpace(d[f+1],!1);x=q-x+z;y=u-y+B;var D=d[f].sourceEdges.iterator;for(D.reset();D.next();)if(z=D.value,B=z.fromVertex,
z.valid&&B.layer===b){for(z=0;d[z]!==B;)z++;z<f&&(p+=2*(f-z),r+=2*(f+1-z));z===f+1&&(p+=1);z>f+1&&(p+=4*(z-f),r+=4*(z-(f+1)))}D=d[f].destinationEdges.iterator;for(D.reset();D.next();)if(z=D.value,B=z.toVertex,z.valid&&B.layer===b){for(z=0;d[z]!==B;)z++;z===f+1&&(r+=1)}D=d[f+1].sourceEdges.iterator;for(D.reset();D.next();)if(z=D.value,B=z.fromVertex,z.valid&&B.layer===b){for(z=0;d[z]!==B;)z++;z<f&&(p+=2*(f+1-z),r+=2*(f-z));z===f&&(r+=1);z>f+1&&(p+=4*(z-(f+1)),r+=4*(z-f))}D=d[f+1].destinationEdges.iterator;
for(D.reset();D.next();)if(z=D.value,B=z.toVertex,z.valid&&B.layer===b){for(z=0;d[z]!==B;)z++;z===f&&(p+=1)}z=B=0;D=g[d[f].index];var C=h[d[f].index],J=g[d[f+1].index],S=h[d[f+1].index];-1!==D&&(B+=Math.abs(D-q),z+=Math.abs(D-y));-1!==C&&(B+=Math.abs(C-q),z+=Math.abs(C-y));-1!==J&&(B+=Math.abs(J-u),z+=Math.abs(J-x));-1!==S&&(B+=Math.abs(S-u),z+=Math.abs(S-x));if(r<p-.5||r===p&&n<m-.5||r===p&&n===m&&z<B-.5)l=k=!0,d[f].column=y,d[f+1].column=x,m=d[f],d[f]=d[f+1],d[f+1]=m}for(f=0;f<e;f++)d[f].index=
f;Os(a,b,d);return k}
Es.prototype.straightenAndPack=function(){var a=0!==(this.mg&1);var b=0!==(this.mg&qt);1E3<this.network.edges.count&&b&&(a=!1);if(a){var c=[];for(b=0;b<=this.xa;b++)c[b]=0;for(var d,e=this.network.vertexes.iterator;e.next();){var f=e.value;b=f.layer;d=f.column;f=this.nodeMinColumnSpace(f,!1);c[b]=Math.max(c[b],d+f)}for(e.reset();e.next();)f=e.value,b=f.layer,d=f.column,f.column=(8*(this.Ja-c[b])>>1)+8*d;this.Ja*=8}if(0!==(this.mg&2))for(c=!0;c;){c=!1;for(b=this.zc+1;b<=this.xa;b++)c=rt(this,b,1)||
c;for(b=this.zc-1;0<=b;b--)c=rt(this,b,-1)||c;c=rt(this,this.zc,0)||c}if(0!==(this.mg&4)){for(b=this.zc+1;b<=this.xa;b++)st(this,b,1);for(b=this.zc-1;0<=b;b--)st(this,b,-1);st(this,this.zc,0)}a&&(tt(this,-1),tt(this,1));if(0!==(this.mg&2))for(c=!0;c;){c=!1;c=rt(this,this.zc,0)||c;for(b=this.zc+1;b<=this.xa;b++)c=rt(this,b,0)||c;for(b=this.zc-1;0<=b;b--)c=rt(this,b,0)||c}};
function rt(a,b,c){G&&(E(b,Es,"bendStraighten:unfixedLayer"),E(c,Es,"bendStraighten:direction"));for(var d=!1;ut(a,b,c);)d=!0;return d}
function ut(a,b,c){G&&(E(b,Es,"shiftbendStraighten:unfixedLayer"),E(c,Es,"shiftbendStraighten:direction"));var d,e=Ns(a,b),f=a.Fb[b],g=Us(a,b,-1);if(0<c)for(d=0;d<f;d++)g[d]=-1;var h=Us(a,b,1);if(0>c)for(d=0;d<f;d++)h[d]=-1;for(var k=!1,l=!0;l;)for(l=!1,d=0;d<f;d++){var m=e[d].column,n=a.nodeMinColumnSpace(e[d],!0),p=a.nodeMinColumnSpace(e[d],!1),r=0;0>d-1||m-e[d-1].column-1>n+a.nodeMinColumnSpace(e[d-1],!1)?r=m-1:r=m;n=d+1>=f||e[d+1].column-m-1>p+a.nodeMinColumnSpace(e[d+1],!0)?m+1:m;var q=p=0,u=
0;if(0>=c)for(var x=e[d].sourceEdges.iterator;x.next();){var y=x.value;var z=y.fromVertex;if(y.valid&&z.layer!==b){var B=Ps(y);var D=y.portFromColOffset;y=y.portToColOffset;z=z.column;p+=(Math.abs(m+y-(z+D))+1)*B;q+=(Math.abs(r+y-(z+D))+1)*B;u+=(Math.abs(n+y-(z+D))+1)*B}}if(0<=c)for(x=e[d].destinationEdges.iterator;x.next();)y=x.value,z=y.toVertex,y.valid&&z.layer!==b&&(B=Ps(y),D=y.portFromColOffset,y=y.portToColOffset,z=z.column,p+=(Math.abs(m+D-(z+y))+1)*B,q+=(Math.abs(r+D-(z+y))+1)*B,u+=(Math.abs(n+
D-(z+y))+1)*B);y=D=B=0;x=g[e[d].index];z=h[e[d].index];-1!==x&&(B+=Math.abs(x-m),D+=Math.abs(x-r),y+=Math.abs(x-n));-1!==z&&(B+=Math.abs(z-m),D+=Math.abs(z-r),y+=Math.abs(z-n));if(q<p||q===p&&D<B)l=k=!0,e[d].column=r;else if(u<p||u===p&&y<B)l=k=!0,e[d].column=n}Os(a,b,e);a.normalize();return k}
function st(a,b,c){G&&(E(b,Es,"medianStraighten:unfixedLayer"),E(c,Es,"medianStraighten:direction"));var d=Ns(a,b),e=a.Fb[b],f=Vs(a,b,c),g=[];for(c=0;c<e;c++)g[c]=f[c];for(f=!0;f;)for(f=!1,c=0;c<e;c++){var h=d[c].column,k=a.nodeMinColumnSpace(d[c],!0),l=a.nodeMinColumnSpace(d[c],!1),m=0;if(-1===g[c])if(0===c&&c===e-1)m=h;else if(0===c){var n=d[c+1].column;n-h===l+a.nodeMinColumnSpace(d[c+1],!0)?m=h-1:m=h}else c===e-1?(n=d[c-1].column,m=h-n===k+a.nodeMinColumnSpace(d[c-1],!1)?h+1:h):(n=d[c-1].column,
k=n+a.nodeMinColumnSpace(d[c-1],!1)+k+1,n=d[c+1].column,l=n-a.nodeMinColumnSpace(d[c+1],!0)-l-1,m=(k+l)/2|0);else 0===c&&c===e-1?m=g[c]:0===c?(n=d[c+1].column,l=n-a.nodeMinColumnSpace(d[c+1],!0)-l-1,m=Math.min(g[c],l)):c===e-1?(n=d[c-1].column,k=n+a.nodeMinColumnSpace(d[c-1],!1)+k+1,m=Math.max(g[c],k)):(n=d[c-1].column,k=n+a.nodeMinColumnSpace(d[c-1],!1)+k+1,n=d[c+1].column,l=n-a.nodeMinColumnSpace(d[c+1],!0)-l-1,k<g[c]&&g[c]<l?m=g[c]:k>=g[c]?m=k:l<=g[c]&&(m=l));m!==h&&(f=!0,d[c].column=m)}Os(a,b,
d);a.normalize()}function vt(a,b){G&&(E(b,Es,"packAux:column"),E(1,Es,"packAux:direction"));for(var c=!0,d=a.network.vertexes.iterator;d.next();){var e=d.value,f=a.nodeMinColumnSpace(e,!0),g=a.nodeMinColumnSpace(e,!1);if(e.column-f<=b&&e.column+g>=b){c=!1;break}}a=!1;if(c)for(d.reset();d.next();)c=d.value,c.column>b&&(--c.column,a=!0);return a}
function wt(a,b){G&&(E(b,Es,"tightPackAux:column"),E(1,Es,"tightPackAux:direction"));var c=b+1;var d,e=[],f=[];for(d=0;d<=a.xa;d++)e[d]=!1,f[d]=!1;for(var g=a.network.vertexes.iterator;g.next();){d=g.value;var h=d.column-a.nodeMinColumnSpace(d,!0),k=d.column+a.nodeMinColumnSpace(d,!1);h<=b&&k>=b&&(e[d.layer]=!0);h<=c&&k>=c&&(f[d.layer]=!0)}h=!0;c=!1;for(d=0;d<=a.xa;d++)h=h&&!(e[d]&&f[d]);if(h)for(g.reset();g.next();)a=g.value,a.column>b&&(--a.column,c=!0);return c}
function tt(a,b){G&&E(b,Es,"componentPack:direction");for(var c=0;c<=a.Ja;c++)for(;vt(a,c););a.normalize();for(c=0;c<a.Ja;c++)for(;wt(a,c););a.normalize();var d;if(0<b)for(c=0;c<=a.Ja;c++){var e=Qs(a);var f=Ts(a);for(d=f+1;f<d;){d=f;xt(a,c,1);var g=Ts(a);g>f?Rs(a,e):g<f&&(f=g,e=Qs(a))}}if(0>b)for(c=a.Ja;0<=c;c--)for(e=Qs(a),f=Ts(a),d=f+1;f<d;)d=f,xt(a,c,-1),g=Ts(a),g>f?Rs(a,e):g<f&&(f=g,e=Qs(a));a.normalize()}
function xt(a,b,c){a.Lc=0;for(var d=a.network.vertexes.iterator;d.next();)d.value.component=-1;if(0<c)for(d.reset();d.next();){var e=d.value;e.column-a.nodeMinColumnSpace(e,!0)<=b&&(e.component=a.Lc)}if(0>c)for(d.reset();d.next();)e=d.value,e.column+a.nodeMinColumnSpace(e,!1)>=b&&(e.component=a.Lc);a.Lc++;for(d.reset();d.next();)b=d.value,-1===b.component&&(Xs(a,b,a.Lc,-1,!0,!0),a.Lc++);var f;b=[];for(f=0;f<a.Lc*a.Lc;f++)b[f]=!1;e=[];for(f=0;f<(a.xa+1)*(a.Ja+1);f++)e[f]=-1;for(d.reset();d.next();){f=
d.value;for(var g=f.layer,h=Math.max(0,f.column-a.nodeMinColumnSpace(f,!0)),k=Math.min(a.Ja,f.column+a.nodeMinColumnSpace(f,!1));h<=k;h++)e[g*(a.Ja+1)+h]=f.component}for(f=0;f<=a.xa;f++){if(0<c)for(g=0;g<a.Ja;g++)-1!==e[f*(a.Ja+1)+g]&&-1!==e[f*(a.Ja+1)+g+1]&&e[f*(a.Ja+1)+g]!==e[f*(a.Ja+1)+g+1]&&(b[e[f*(a.Ja+1)+g]*a.Lc+e[f*(a.Ja+1)+g+1]]=!0);if(0>c)for(g=a.Ja;0<g;g--)-1!==e[f*(a.Ja+1)+g]&&-1!==e[f*(a.Ja+1)+g-1]&&e[f*(a.Ja+1)+g]!==e[f*(a.Ja+1)+g-1]&&(b[e[f*(a.Ja+1)+g]*a.Lc+e[f*(a.Ja+1)+g-1]]=!0)}e=
[];for(f=0;f<a.Lc;f++)e[f]=!0;g=[];for(g.push(0);0!==g.length;)if(k=g[g.length-1],g.pop(),e[k])for(e[k]=!1,f=0;f<a.Lc;f++)b[k*a.Lc+f]&&g.splice(0,0,f);if(0<c)for(d.reset();d.next();)a=d.value,e[a.component]&&--a.column;if(0>c)for(d.reset();d.next();)c=d.value,e[c.component]&&(c.column+=1)}
Es.prototype.commitLayout=function(){if(this.setsPortSpots)for(var a=Ls(this,!0),b=Ls(this,!1),c=this.network.edges.iterator;c.next();){var d=c.value.link;null!==d&&(d.fromSpot=a,d.toSpot=b)}this.commitNodes();this.Ou();this.isRouting&&this.commitLinks()};function Ls(a,b){return 270===a.N?b?kd:nd:90===a.N?b?nd:kd:180===a.N?b?ld:md:b?md:ld}
Es.prototype.commitNodes=function(){this.ge=[];this.Ed=[];this.Dd=[];this.Pa=[];for(var a=0;a<=this.xa;a++)this.ge[a]=0,this.Ed[a]=0,this.Dd[a]=0,this.Pa[a]=0;for(a=this.network.vertexes.iterator;a.next();){var b=a.value,c=b.layer;this.ge[c]=Math.max(this.ge[c],this.nodeMinLayerSpace(b,!0));this.Ed[c]=Math.max(this.Ed[c],this.nodeMinLayerSpace(b,!1))}b=0;c=this.he;for(var d=0;d<=this.xa;d++){var e=c;0>=this.ge[d]+this.Ed[d]&&(e=0);0<d&&(b+=e/2);90===this.N||0===this.N?(b+=this.Ed[d],this.Dd[d]=b,
b+=this.ge[d]):(b+=this.ge[d],this.Dd[d]=b,b+=this.Ed[d]);d<this.xa&&(b+=e/2);this.Pa[d]=b}c=b;b=this.arrangementOrigin;for(d=0;d<=this.xa;d++)270===this.N?this.Dd[d]=b.y+this.Dd[d]:90===this.N?(this.Dd[d]=b.y+c-this.Dd[d],this.Pa[d]=c-this.Pa[d]):180===this.N?this.Dd[d]=b.x+this.Dd[d]:(this.Dd[d]=b.x+c-this.Dd[d],this.Pa[d]=c-this.Pa[d]);a.reset();for(c=d=Infinity;a.next();){e=a.value;var f=e.layer,g=e.column|0;if(270===this.N||90===this.N){var h=b.x+this.gc*g;f=this.Dd[f]}else h=this.Dd[f],f=b.y+
this.gc*g;e.centerX=h;e.centerY=f;d=Math.min(e.x,d);c=Math.min(e.y,c)}d=b.x-d;b=b.y-c;this.Yc=new K(d,b);for(a.reset();a.next();)c=a.value,c.x+=d,c.y+=b,c.commit()};
Es.prototype.Ou=function(){for(var a=0,b=this.he,c=0;c<=this.xa;c++)a+=this.ge[c],a+=this.Ed[c];a+=this.xa*b;b=[];c=this.gc*this.Ja;for(var d=this.maxLayer;0<=d;d--)270===this.N?0===d?b.push(new M(0,0,c,Math.abs(this.Pa[0]))):b.push(new M(0,this.Pa[d-1],c,Math.abs(this.Pa[d-1]-this.Pa[d]))):90===this.N?0===d?b.push(new M(0,this.Pa[0],c,Math.abs(this.Pa[0]-a))):b.push(new M(0,this.Pa[d],c,Math.abs(this.Pa[d-1]-this.Pa[d]))):180===this.N?0===d?b.push(new M(0,0,Math.abs(this.Pa[0]),c)):b.push(new M(this.Pa[d-
1],0,Math.abs(this.Pa[d-1]-this.Pa[d]),c)):0===d?b.push(new M(this.Pa[0],0,Math.abs(this.Pa[0]-a),c)):b.push(new M(this.Pa[d],0,Math.abs(this.Pa[d-1]-this.Pa[d]),c));this.commitLayers(b,this.Yc)};Es.prototype.commitLayers=function(){};
Es.prototype.commitLinks=function(){for(var a=this.network.edges.iterator,b;a.next();)b=a.value.link,null!==b&&(b.Wh(),b.ak(),b.Hf());for(a.reset();a.next();)b=a.value.link,null!==b&&b.Gg();for(a.reset();a.next();){var c=a.value;b=c.link;if(null!==b){b.Wh();var d=b,e=d.fromNode,f=d.toNode,g=d.fromPort,h=d.toPort;if(null!==e){var k=e.findVisibleNode();null!==k&&k!==e&&(e=k,g=k.port)}null!==f&&(k=f.findVisibleNode(),null!==k&&k!==f&&(f=k,h=k.port));var l=b.computeSpot(!0,g);k=b.computeSpot(!1,h);var m=
c.fromVertex,n=c.toVertex;if(c.valid){if(b.curve===gg&&4===b.pointsCount)if(m.column===n.column)c=b.getLinkPoint(e,g,l,!0,!1,f,h),g=b.getLinkPoint(f,h,k,!1,!1,e,g),c.s()||c.set(e.actualBounds.center),g.s()||g.set(f.actualBounds.center),b.ak(),b.Ff(c.x,c.y),b.Ff((2*c.x+g.x)/3,(2*c.y+g.y)/3),b.Ff((c.x+2*g.x)/3,(c.y+2*g.y)/3),b.Ff(g.x,g.y);else{var p=!1,r=!1;null!==g&&l===Bc&&(p=!0);null!==h&&k===Bc&&(r=!0);if(p||r){var q=b.i(0).x;c=b.i(0).y;m=b.i(3).x;d=b.i(3).y;if(p){if(90===this.N||270===this.N){p=
q;var u=(c+d)/2}else p=(q+m)/2,u=c;b.P(1,p,u);l=b.getLinkPoint(e,g,l,!0,!1,f,h);l.s()||l.set(e.actualBounds.center);b.P(0,l.x,l.y)}r&&(90===this.N||270===this.N?(l=m,c=(c+d)/2):(l=(q+m)/2,c=d),b.P(2,l,c),e=b.getLinkPoint(f,h,k,!1,!1,e,g),e.s()||e.set(f.actualBounds.center),b.P(3,e.x,e.y))}}b.Hf()}else if(m.layer===n.layer)b.Hf();else{p=r=!1;u=this.he;q=b.firstPickIndex+1;if(b.isOrthogonal){p=!0;var x=b.pointsCount;4<x&&b.points.removeRange(2,x-3)}else if(b.curve===gg)r=!0,x=b.pointsCount,4<x&&b.points.removeRange(2,
x-3),4===x&&(q=2);else{x=b.pointsCount;var y=l===Bc,z=k===Bc;2<x&&y&&z?b.points.removeRange(1,x-2):3<x&&y&&!z?b.points.removeRange(1,x-3):3<x&&!y&&z?b.points.removeRange(2,x-2):4<x&&!y&&!z&&b.points.removeRange(2,x-3)}if(c.rev){for(;null!==n&&m!==n;){var B=x=null;for(y=n.sourceEdges.iterator;y.next()&&(z=y.value,z.link!==c.link||(x=z.fromVertex,B=z.toVertex,null!==x.node)););if(null===x)break;if(x!==m){y=b.i(q-1).x;z=b.i(q-1).y;var D=x.centerX;var C=x.centerY;if(p)180===this.N||0===this.N?q===b.firstPickIndex+
1?(b.l(q++,y,z),b.l(q++,y,C)):(null!==B?B.centerY:z)!==C&&(B=this.Pa[x.layer-1]+this.Yc.x,b.l(q++,B,z),b.l(q++,B,C)):q===b.firstPickIndex+1?(b.l(q++,y,z),b.l(q++,D,z)):(null!==B?B.centerX:y)!==D&&(B=this.Pa[x.layer-1]+this.Yc.y,b.l(q++,y,B),b.l(q++,D,B));else if(q===b.firstPickIndex+1){B=Math.max(10,this.ge[n.layer]);var J=Math.max(10,this.Ed[n.layer]);if(r)180===this.N?D<=n.bounds.x?(n=n.bounds.x,b.l(q++,n-B,C),b.l(q++,n,C),b.l(q++,n+J,C)):(b.l(q++,D-B,C),b.l(q++,D,C),b.l(q++,D+J,C)):90===this.N?
C>=n.bounds.bottom?(n=n.bounds.y+n.bounds.height,b.l(q++,D,n+J),b.l(q++,D,n),b.l(q++,D,n-B)):(b.l(q++,D,C+J),b.l(q++,D,C),b.l(q++,D,C-B)):270===this.N?C<=n.bounds.y?(n=n.bounds.y,b.l(q++,D,n-B),b.l(q++,D,n),b.l(q++,D,n+J)):(b.l(q++,D,C-B),b.l(q++,D,C),b.l(q++,D,C+J)):0===this.N&&(D>=n.bounds.right?(n=n.bounds.x+n.bounds.width,b.l(q++,n+J,C),b.l(q++,n,C),b.l(q++,n-B,C)):(b.l(q++,D+J,C),b.l(q++,D,C),b.l(q++,D-B,C)));else{b.l(q++,y,z);var S=0;if(180===this.N||0===this.N){if(180===this.N?D>=n.bounds.right:
D<=n.bounds.x)S=(0===this.N?-B:J)/2;b.l(q++,y+S,C)}else{if(270===this.N?C>=n.bounds.bottom:C<=n.bounds.y)S=(90===this.N?-B:J)/2;b.l(q++,D,z+S)}b.l(q++,D,C)}}else B=Math.max(10,this.ge[x.layer]),J=Math.max(10,this.Ed[x.layer]),r?180===this.N?(b.l(q++,D-B-u,C),b.l(q++,Math.min(D-B+u/2,D),C),b.l(q++,D,C),b.l(q++,D,C),b.l(q++,Math.max(D+J-u/2,D),C),b.l(q++,D+J+u,C)):90===this.N?(b.l(q++,D,C+J+u),b.l(q++,D,Math.max(C+J-u/2,C)),b.l(q++,D,C),b.l(q++,D,C),b.l(q++,D,Math.min(C-B+u/2,C)),b.l(q++,D,C-B-u)):
270===this.N?(b.l(q++,D,C-B-u),b.l(q++,D,Math.min(C-B+u/2,C)),b.l(q++,D,C),b.l(q++,D,C),b.l(q++,D,Math.max(C+J-u/2,C)),b.l(q++,D,C+J+u)):(b.l(q++,D+J+u,C),b.l(q++,Math.max(D+J-u/2,D),C),b.l(q++,D,C),b.l(q++,D,C),b.l(q++,Math.min(D-B+u/2,D),C),b.l(q++,D-B-u,C)):b.l(q++,D,C)}n=x}if(null===h||l!==Bc||p)if(y=b.i(q-1).x,z=b.i(q-1).y,D=b.i(q).x,C=b.i(q).y,p)u=this.Ed[m.layer],180===this.N||0===this.N?(p=z,p>=m.bounds.y&&p<=m.bounds.bottom&&(180===this.N?D>=m.bounds.x:D<=m.bounds.right)&&(n=m.centerX+(180===
this.N?-u:u),p<m.bounds.y+m.bounds.height/2?p=m.bounds.y-this.gc/2:p=m.bounds.bottom+this.gc/2,b.l(q++,n,z),b.l(q++,n,p)),b.l(q++,D,p)):(p=y,p>=m.bounds.x&&p<=m.bounds.right&&(270===this.N?C>=m.bounds.y:C<=m.bounds.bottom)&&(n=m.centerY+(270===this.N?-u:u),p<m.bounds.x+m.bounds.width/2?p=m.bounds.x-this.gc/2:p=m.bounds.right+this.gc/2,b.l(q++,y,n),b.l(q++,p,n)),b.l(q++,p,C)),b.l(q++,D,C);else if(r)B=Math.max(10,this.ge[m.layer]),J=Math.max(10,this.Ed[m.layer]),180===this.N&&D>=m.bounds.x?(n=m.bounds.x+
m.bounds.width,b.P(q-2,n,z),b.P(q-1,n+J,z)):90===this.N&&C<=m.bounds.bottom?(n=m.bounds.y,b.P(q-2,y,n),b.P(q-1,y,n-B)):270===this.N&&C>=m.bounds.y?(n=m.bounds.y+m.bounds.height,b.P(q-2,y,n),b.P(q-1,y,n+J)):0===this.N&&D<=m.bounds.right&&(n=m.bounds.x,b.P(q-2,n,z),b.P(q-1,n-B,z));else{B=Math.max(10,this.ge[m.layer]);J=Math.max(10,this.Ed[m.layer]);p=0;if(180===this.N||0===this.N){if(180===this.N?D<=m.bounds.x:D>=m.bounds.right)p=(0===this.N?J:-B)/2;b.l(q++,D+p,z)}else{if(270===this.N?C<=m.bounds.y:
C>=m.bounds.bottom)p=(90===this.N?J:-B)/2;b.l(q++,y,C+p)}b.l(q++,D,C)}}else{for(;null!==m&&m!==n;){B=x=null;for(m=m.destinationEdges.iterator;m.next()&&(y=m.value,y.link!==c.link||(x=y.toVertex,B=y.fromVertex,null!==B.node&&(B=null),null!==x.node)););if(null===x)break;x!==n&&(y=b.i(q-1).x,z=b.i(q-1).y,D=x.centerX,C=x.centerY,p?180===this.N||0===this.N?(null!==B?B.centerY:z)!==C&&(B=this.Pa[x.layer]+this.Yc.x,q===b.firstPickIndex+1&&(B=0===this.N?Math.max(B,y):Math.min(B,y)),b.l(q++,B,z),b.l(q++,B,
C)):(null!==B?B.centerX:y)!==D&&(B=this.Pa[x.layer]+this.Yc.y,q===b.firstPickIndex+1&&(B=90===this.N?Math.max(B,z):Math.min(B,z)),b.l(q++,y,B),b.l(q++,D,B)):(B=Math.max(10,this.ge[x.layer]),J=Math.max(10,this.Ed[x.layer]),r?180===this.N?(b.l(q++,D+J+u,C),b.l(q++,Math.max(D+J-u/2,D),C),b.l(q++,D,C),b.l(q++,D,C),b.l(q++,Math.min(D-B+u/2,D),C),b.l(q++,D-B-u,C)):90===this.N?(b.l(q++,D,C-B-u),b.l(q++,D,Math.min(C-B+u/2,C)),b.l(q++,D,C),b.l(q++,D,C),b.l(q++,D,Math.max(C+J-u/2,C)),b.l(q++,D,C+J+u)):270===
this.N?(b.l(q++,D,C+J+u),b.l(q++,D,Math.max(C+J-u/2,C)),b.l(q++,D,C),b.l(q++,D,C),b.l(q++,D,Math.min(C-B+u/2,C)),b.l(q++,D,C-B-u)):(b.l(q++,D-B-u,C),b.l(q++,Math.min(D-B+u/2,D),C),b.l(q++,D,C),b.l(q++,D,C),b.l(q++,Math.max(D+J-u/2,D),C),b.l(q++,D+J+u,C)):180===this.N?(b.l(q++,D+J,C),b.l(q++,D-B,C)):90===this.N?(b.l(q++,D,C-B),b.l(q++,D,C+J)):270===this.N?(b.l(q++,D,C+J),b.l(q++,D,C-B)):(b.l(q++,D-B,C),b.l(q++,D+J,C))));m=x}p&&(y=b.i(q-1).x,z=b.i(q-1).y,D=b.i(q).x,C=b.i(q).y,180===this.N||0===this.N?
z!==C&&(B=0===this.N?Math.min(Math.max((D+y)/2,this.Pa[n.layer]+this.Yc.x),D):Math.max(Math.min((D+y)/2,this.Pa[n.layer]+this.Yc.x),D),b.l(q++,B,z),b.l(q++,B,C)):y!==D&&(B=90===this.N?Math.min(Math.max((C+z)/2,this.Pa[n.layer]+this.Yc.y),C):Math.max(Math.min((C+z)/2,this.Pa[n.layer]+this.Yc.y),C),b.l(q++,y,B),b.l(q++,D,B)))}null!==d&&r&&(null!==g&&(l===Bc&&(l=b.i(0),d=b.i(2),l.B(d)||b.P(1,(l.x+d.x)/2,(l.y+d.y)/2)),l=b.getLinkPoint(e,g,Bc,!0,!1,f,h),l.s()||l.set(e.actualBounds.center),b.P(0,l.x,l.y)),
null!==h&&(k===Bc&&(k=b.i(b.pointsCount-1),l=b.i(b.pointsCount-3),k.B(l)||b.P(b.pointsCount-2,(k.x+l.x)/2,(k.y+l.y)/2)),e=b.getLinkPoint(f,h,Bc,!1,!1,e,g),e.s()||e.set(f.actualBounds.center),b.P(b.pointsCount-1,e.x,e.y)));b.Hf();c.commit()}}}this.avoidOrthogonalOverlaps()};
Es.prototype.avoidOrthogonalOverlaps=function(){if(!(0>=this.linkSpacing)){for(var a=new H,b=this.network.edges.iterator;b.next();){var c=b.value.link;null!==c&&c.isOrthogonal&&!a.contains(c)&&a.add(c)}if(0<a.count)if(90===this.N||270===this.N){b=0;c=[];for(a=a.iterator;a.next();){var d=a.value;if(null!==d&&d.isOrthogonal)for(var e=2;e<d.pointsCount-3;e++){var f=d.i(e);var g=d.i(e+1);if(this.A(f.y,g.y)&&!this.A(f.x,g.x)){var h=new yt;h.layer=Math.floor(f.y/2);var k=d.i(0),l=d.i(d.pointsCount-1);h.first=
k.x*k.x+k.y;h.fc=l.x*l.x+l.y;h.md=Math.min(f.x,g.x);h.Dc=Math.max(f.x,g.x);h.index=e;h.link=d;if(e+2<d.pointsCount){k=d.i(e-1);l=d.i(e+2);var m=0;k.y<f.y?m=l.y<f.y?3:f.x<g.x?2:1:k.y>f.y&&(m=l.y>f.y?0:g.x<f.x?2:1);h.j=m}c.push(h)}}}if(1<c.length)for(c.sort(this.Ky),a=0;a<c.length;){f=c[a].layer;for(d=a+1;d<c.length&&c[d].layer===f;)d++;if(1<d-a)for(f=a;f<d;){g=c[f].Dc;for(e=a+1;e<d&&c[e].md<g;)g=Math.max(g,c[e].Dc),e++;g=e-f;if(1<g){this.gj(c,this.ct,f,f+g);m=1;h=c[f].fc;for(k=f;k<e;k++)l=c[k],l.fc!==
h&&(m++,h=l.fc);this.gj(c,this.Jy,f,f+g);var n=1;h=c[f].first;for(k=f;k<e;k++)l=c[k],l.first!==h&&(n++,h=l.first);k=!0;l=n;m<n?(k=!1,l=m,h=c[f].fc,this.gj(c,this.ct,f,f+g)):h=c[f].first;m=0;for(n=f;n<e;n++){var p=c[n];(k?p.first:p.fc)!==h&&(m++,h=k?p.first:p.fc);var r=p.link;f=r.i(p.index);g=r.i(p.index+1);var q=this.linkSpacing*(m-(l-1)/2);if(!r.isAvoiding||zt(f.x,f.y+q,g.x,g.y+q))b++,r.Wh(),r.P(p.index,f.x,f.y+q),r.P(p.index+1,g.x,g.y+q),r.Hf()}}f=e}a=d}}else{b=0;c=[];for(a=a.iterator;a.next();)if(d=
a.value,null!==d&&d.isOrthogonal)for(e=2;e<d.pointsCount-3;e++)f=d.i(e),g=d.i(e+1),this.A(f.x,g.x)&&!this.A(f.y,g.y)&&(h=new yt,h.layer=Math.floor(f.x/2),k=d.i(0),l=d.i(d.pointsCount-1),h.first=k.x+k.y*k.y,h.fc=l.x+l.y*l.y,h.md=Math.min(f.y,g.y),h.Dc=Math.max(f.y,g.y),h.index=e,h.link=d,e+2<d.pointsCount&&(k=d.i(e-1),l=d.i(e+2),m=0,k.x<f.x?m=l.x<f.x?3:f.y<g.y?2:1:k.x>f.x&&(m=l.x>f.x?0:g.y<f.y?2:1),h.j=m),c.push(h));if(1<c.length)for(c.sort(this.Ky),a=0;a<c.length;){f=c[a].layer;for(d=a+1;d<c.length&&
c[d].layer===f;)d++;if(1<d-a)for(f=a;f<d;){g=c[f].Dc;for(e=a+1;e<d&&c[e].md<g;)g=Math.max(g,c[e].Dc),e++;g=e-f;if(1<g){this.gj(c,this.ct,f,f+g);m=1;h=c[f].fc;for(k=f;k<e;k++)l=c[k],l.fc!==h&&(m++,h=l.fc);this.gj(c,this.Jy,f,f+g);n=1;h=c[f].first;for(k=f;k<e;k++)l=c[k],l.first!==h&&(n++,h=l.first);k=!0;l=n;m<n?(k=!1,l=m,h=c[f].fc,this.gj(c,this.ct,f,f+g)):h=c[f].first;m=0;for(n=f;n<e;n++)if(p=c[n],(k?p.first:p.fc)!==h&&(m++,h=k?p.first:p.fc),r=p.link,f=r.i(p.index),g=r.i(p.index+1),q=this.linkSpacing*
(m-(l-1)/2),!r.isAvoiding||zt(f.x+q,f.y,g.x+q,g.y))b++,r.Wh(),r.P(p.index,f.x+q,f.y),r.P(p.index+1,g.x+q,g.y),r.Hf()}f=e}a=d}}}};t=Es.prototype;t.Ky=function(a,b){return a instanceof yt&&b instanceof yt&&a!==b?a.layer<b.layer?-1:a.layer>b.layer?1:a.md<b.md?-1:a.md>b.md?1:a.Dc<b.Dc?-1:a.Dc>b.Dc?1:0:0};t.Jy=function(a,b){return a instanceof yt&&b instanceof yt&&a!==b?a.first<b.first?-1:a.first>b.first||a.j<b.j?1:a.j>b.j||a.md<b.md?-1:a.md>b.md?1:a.Dc<b.Dc?-1:a.Dc>b.Dc?1:0:0};
t.ct=function(a,b){return a instanceof yt&&b instanceof yt&&a!==b?a.fc<b.fc?-1:a.fc>b.fc||a.j<b.j?1:a.j>b.j||a.md<b.md?-1:a.md>b.md?1:a.Dc<b.Dc?-1:a.Dc>b.Dc?1:0:0};t.A=function(a,b){G&&(E(a,Es,"isApprox:a"),E(b,Es,"isApprox:b"));a-=b;return-1<a&&1>a};
t.gj=function(a,b,c,d){var e=a.length,f=d-c;if(!(1>=f))if((0>c||c>=e-1)&&v("not in range 0 <= from < length: "+c),2===f)d=a[c],e=a[c+1],0<b(d,e)&&(a[c]=e,a[c+1]=d);else if(0===c)if(d>=e)a.sort(b);else for(c=a.slice(0,d),c.sort(b),b=0;b<d;b++)a[b]=c[b];else if(d>=e)for(d=a.slice(c),d.sort(b),b=c;b<e;b++)a[b]=d[b-c];else for(e=a.slice(c,d),e.sort(b),b=c;b<d;b++)a[b]=e[b-c]};
function zt(a,b,c,d){G&&(E(a,Es,"isUnoccupied2:px"),E(b,Es,"isUnoccupied2:py"),E(c,Es,"isUnoccupied2:qx"),E(d,Es,"isUnoccupied2:qy"));return!0}function Ns(a,b){var c=a.Fb[b];if(c>=a.Je.length){var d=[];for(var e=0;e<a.Je.length;e++)d[e]=a.Je[e];a.Je=d}void 0===a.Je[c]||null===a.Je[c]?d=[]:(d=a.Je[c],a.Je[c]=null);a=a.Mo[b];for(b=0;b<a.length;b++)c=a[b],d[c.index]=c;return d}function Os(a,b,c){a.Je[a.Fb[b]]=c}
na.Object.defineProperties(Es.prototype,{layerSpacing:{configurable:!0,get:function(){return this.he},set:function(a){this.he!==a&&(A(a,"number",Es,"layerSpacing"),0<=a&&(this.he=a,this.C()))}},columnSpacing:{configurable:!0,get:function(){return this.gc},set:function(a){this.gc!==a&&(A(a,"number",Es,"columnSpacing"),0<a&&(this.gc=a,this.C()))}},direction:{configurable:!0,get:function(){return this.N},set:function(a){this.N!==a&&(A(a,"number",Es,"direction"),
0===a||90===a||180===a||270===a?(this.N=a,this.C()):v("LayeredDigraphLayout.direction must be 0, 90, 180, or 270"))}},cycleRemoveOption:{configurable:!0,get:function(){return this.Wk},set:function(a){this.Wk!==a&&(db(a,Es,Es,"cycleRemoveOption"),a===Ys||a===Fs||a===Ks)&&(this.Wk=a,this.C())}},layeringOption:{configurable:!0,get:function(){return this.vl},set:function(a){this.vl!==a&&(db(a,Es,Es,"layeringOption"),a===Gs||a===ct||a===et)&&(this.vl=a,this.C())}},initializeOption:{configurable:!0,
enumerable:!0,get:function(){return this.ll},set:function(a){this.ll!==a&&(db(a,Es,Es,"initializeOption"),a===Hs||a===kt||a===it)&&(this.ll=a,this.C())}},iterations:{configurable:!0,get:function(){return this.Cj},set:function(a){this.Cj!==a&&(E(a,Js,"iterations"),0<=a&&(this.Cj=a,this.C()))}},aggressiveOption:{configurable:!0,get:function(){return this.Hk},set:function(a){this.Hk!==a&&(db(a,Es,Es,"aggressiveOption"),a===ot||a===Is||a===pt)&&(this.Hk=a,this.C())}},packOption:{configurable:!0,
enumerable:!0,get:function(){return this.mg},set:function(a){this.mg!==a&&(A(a,"number",Es,"packOption"),0<=a&&8>a&&(this.mg=a,this.C()))}},setsPortSpots:{configurable:!0,get:function(){return this.vf},set:function(a){this.vf!==a&&(A(a,"boolean",Es,"setsPortSpots"),this.vf=a,this.C())}},linkSpacing:{configurable:!0,get:function(){return this.wo},set:function(a){this.wo!==a&&(A(a,"number",Es,"linkSpacing"),0<=a&&(this.wo=a,this.C()))}},maxLayer:{configurable:!0,
get:function(){return this.xa}},maxIndex:{configurable:!0,get:function(){return this.vi}},maxColumn:{configurable:!0,get:function(){return this.Ja}},minIndexLayer:{configurable:!0,get:function(){return this.hh}},maxIndexLayer:{configurable:!0,get:function(){return this.zc}}});
var Fs=new F(Es,"CycleDepthFirst",0),Ys=new F(Es,"CycleGreedy",1),Ks=new F(Es,"CycleFromLayers",2),Gs=new F(Es,"LayerOptimalLinkLength",0),ct=new F(Es,"LayerLongestPathSink",1),et=new F(Es,"LayerLongestPathSource",2),Hs=new F(Es,"InitDepthFirstOut",0),kt=new F(Es,"InitDepthFirstIn",1),it=new F(Es,"InitNaive",2),ot=new F(Es,"AggressiveNone",0),Is=new F(Es,"AggressiveLess",1),pt=new F(Es,"AggressiveMore",2),qt=8;Es.className="LayeredDigraphLayout";Es.CycleDepthFirst=Fs;Es.CycleGreedy=Ys;
Es.CycleFromLayers=Ks;Es.LayerOptimalLinkLength=Gs;Es.LayerLongestPathSink=ct;Es.LayerLongestPathSource=et;Es.InitDepthFirstOut=Hs;Es.InitDepthFirstIn=kt;Es.InitNaive=it;Es.AggressiveNone=ot;Es.AggressiveLess=Is;Es.AggressiveMore=pt;Es.PackNone=0;Es.PackExpand=1;Es.PackStraighten=2;Es.PackMedian=4;Es.PackAll=15;function yt(){this.index=this.Dc=this.md=this.fc=this.first=this.layer=0;this.link=null;this.j=0}yt.className="SegInfo";function Js(a){fq.call(this,a)}ma(Js,fq);Js.prototype.createVertex=function(){return new At(this)};
Js.prototype.createEdge=function(){return new Bt(this)};Js.className="LayeredDigraphNetwork";function At(a){tq.call(this,a);this.Xa=this.Ng=this.ri=-1;this.F=NaN;this.O=null;this.valid=!1;this.finish=this.Ag=NaN;this.Gf=0;this.tk=this.uk=null}ma(At,tq);
At.prototype.serializeVertexProperties=function(a,b){tq.prototype.serializeVertexProperties.call(this,a,b);a.layer=this.layer;a.column=this.column;a.index=this.index;a.component=this.component;a.near=this.near?lb(this.near):null;a.valid=this.valid;a.Ag=this.Ag;a.finish=this.finish;a.Gf=this.Gf;a.uk=this.uk;a.tk=this.tk};
At.prototype.deserializeVertexProperties=function(a,b,c,d){tq.prototype.deserializeVertexProperties.call(this,a,b,c,d);this.layer=a.layer;this.column=a.column;this.index=a.index;this.component=a.component;if(b=b.get(a.near))this.near=b;this.valid=a.valid;this.Ag=a.Ag;this.finish=a.finish;this.Gf=a.Gf;this.uk=a.uk;this.tk=a.tk};
na.Object.defineProperties(At.prototype,{layer:{configurable:!0,get:function(){return this.ri},set:function(a){this.ri!==a&&(A(a,"number",At,"layer"),this.ri=a)}},column:{configurable:!0,get:function(){return this.Ng},set:function(a){this.Ng!==a&&(A(a,"number",At,"column"),this.Ng=a)}},index:{configurable:!0,get:function(){return this.Xa},set:function(a){this.Xa!==a&&(A(a,"number",At,"index"),this.Xa=a)}},component:{configurable:!0,get:function(){return this.F},
set:function(a){this.F!==a&&(A(a,"number",At,"component"),this.F=a)}},near:{configurable:!0,get:function(){return this.O},set:function(a){this.O!==a&&(G&&null!==a&&w(a,At,At,"near"),this.O=a)}}});At.className="LayeredDigraphVertex";function Bt(a){uq.call(this,a);this.j=this.Ha=this.Ra=!1;this.Da=this.F=NaN;this.O=this.o=0}ma(Bt,uq);
Bt.prototype.serializeEdgeProperties=function(a,b){uq.prototype.serializeEdgeProperties.call(this,a,b);a.valid=this.valid;a.rev=this.rev;a.forest=this.forest;a.portFromPos=this.portFromPos;a.portToPos=this.portToPos;a.portFromColOffset=this.portFromColOffset;a.portToColOffset=this.portToColOffset};
Bt.prototype.deserializeEdgeProperties=function(a,b,c,d){uq.prototype.deserializeEdgeProperties.call(this,a,b,c,d);this.valid=a.valid;this.rev=a.rev;this.forest=a.forest;this.portFromPos=a.portFromPos;this.portToPos=a.portToPos;this.portFromColOffset=a.portFromColOffset;this.portToColOffset=a.portToColOffset};
na.Object.defineProperties(Bt.prototype,{fromVertex:{configurable:!0,get:function(){return this.ad},set:function(a){this.ad!==a&&(G&&null!==a&&w(a,At,Bt,"fromVertex"),this.ad=a)}},toVertex:{configurable:!0,get:function(){return this.kd},set:function(a){this.kd!==a&&(G&&null!==a&&w(a,At,Bt,"toVertex"),this.kd=a)}},valid:{configurable:!0,get:function(){return this.Ra},set:function(a){this.Ra!==a&&(A(a,"boolean",Bt,"valid"),this.Ra=a)}},rev:{configurable:!0,
enumerable:!0,get:function(){return this.Ha},set:function(a){this.Ha!==a&&(A(a,"boolean",Bt,"rev"),this.Ha=a)}},forest:{configurable:!0,get:function(){return this.j},set:function(a){this.j!==a&&(A(a,"boolean",Bt,"forest"),this.j=a)}},portFromPos:{configurable:!0,get:function(){return this.F},set:function(a){this.F!==a&&(A(a,"number",Bt,"portFromPos"),this.F=a)}},portToPos:{configurable:!0,get:function(){return this.Da},set:function(a){this.Da!==a&&(A(a,"number",
Bt,"portToPos"),this.Da=a)}},portFromColOffset:{configurable:!0,get:function(){return this.o},set:function(a){this.o!==a&&(A(a,"number",Bt,"portFromColOffset"),this.o=a)}},portToColOffset:{configurable:!0,get:function(){return this.O},set:function(a){this.O!==a&&(A(a,"number",Bt,"portToColOffset"),this.O=a)}}});Bt.className="LayeredDigraphEdge";
function Z(a){zi.call(this);this.Qb=new I;this.Zo=Ct;this.sd=Dt;this.Rp=Et;this.Gr=Ft;this.Ow=[];this.qd=!0;this.Nb=Gt;this.Wd=(new Hb(10,10)).freeze();var b=new Ht(this);this.Z=new It(b);this.$=new It(b);this.xu=[];a&&Object.assign(this,a)}ma(Z,zi);Z.prototype.cloneProtected=function(a){zi.prototype.cloneProtected.call(this,a);a.Zo=this.Zo;a.Rp=this.Rp;a.Gr=this.Gr;a.qd=this.qd;a.Nb=this.Nb;a.Wd.assign(this.Wd);a.Z.copyInheritedPropertiesFrom(this.Z);a.$.copyInheritedPropertiesFrom(this.$)};
Z.prototype.mb=function(a){a.classType===Z?0===a.name.indexOf("Alignment")?this.alignment=a:0===a.name.indexOf("Arrangement")?this.arrangement=a:0===a.name.indexOf("Compaction")?this.compaction=a:0===a.name.indexOf("Path")?this.path=a:0===a.name.indexOf("Sorting")?this.sorting=a:0===a.name.indexOf("Style")?this.treeStyle=a:v("Unknown enum value: "+a):zi.prototype.mb.call(this,a)};Z.prototype.createNetwork=function(){return new Ht(this)};
Z.prototype.makeNetwork=function(a){function b(a){if(a instanceof V)return!a.isLinkLabel&&"Comment"!==a.category;if(a instanceof R){var b=a.fromNode;if(null===b||b.isLinkLabel||"Comment"===b.category)return!1;a=a.toNode;return null===a||a.isLinkLabel||"Comment"===a.category?!1:!0}return!1}var c=this.createNetwork();a instanceof Q?(c.yg(a.nodes,!0,b),c.yg(a.links,!0,b)):a instanceof yf?c.yg(a.memberParts,!1,b):c.yg(a.iterator,!1,b);return c};
Z.prototype.doLayout=function(a){G&&null===a&&v("Layout.doLayout(collection) argument must not be null but a Diagram, a Group, or an Iterable of Parts");null===this.network&&(this.network=this.makeNetwork(a));this.arrangement!==Jt&&(this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin));var b=this.diagram;null===b&&a instanceof Q&&(b=a);this.path===Ct&&null!==b?this.sd=b.isTreePathToChildren?Dt:Kt:this.sd=this.path===Ct?Dt:this.path;if(0<this.network.vertexes.count){this.network.fq();
for(a=this.network.vertexes.iterator;a.next();)b=a.value,b.initialized=!1,b.level=0,b.parent=null,b.children=[];if(0<this.Qb.count){a=new I;for(b=this.Qb.iterator;b.next();){var c=b.value;c instanceof V?(c=this.network.Ui(c),null!==c&&a.add(c)):c instanceof It&&a.add(c)}this.Qb=a}0===this.Qb.count&&this.findRoots();for(a=this.Qb.copy().iterator;a.next();)b=a.value,b.initialized||(b.initialized=!0,Lt(this,b));b=this.network.vertexes;for(a=null;a=Mt(b),0<a.count;)b=Nt(this,a),null!==b&&this.Qb.add(b),
b.initialized=!0,Lt(this,b),b=a;for(a=this.Qb.iterator;a.next();)b=a.value,b instanceof It&&Ot(this,b);for(a=this.Qb.iterator;a.next();)b=a.value,b instanceof It&&Pt(this,b);for(a=this.Qb.iterator;a.next();)b=a.value,b instanceof It&&Qt(this,b);this.Iu();if(this.layerStyle===Rt){a=[];for(b=this.network.vertexes.iterator;b.next();){c=b.value;var d=c.parent;null===d&&(d=c);d=0===d.angle||180===d.angle;var e=a[c.level];void 0===e&&(e=0);a[c.level]=Math.max(e,d?c.width:c.height)}for(b=0;b<a.length;b++)void 0===
a[b]&&(a[b]=0);this.Ow=a;for(b=this.network.vertexes.iterator;b.next();)c=b.value,d=c.parent,null===d&&(d=c),0===d.angle||180===d.angle?(180===d.angle&&(c.focusX+=a[c.level]-c.width),c.width=a[c.level]):(270===d.angle&&(c.focusY+=a[c.level]-c.height),c.height=a[c.level])}else if(this.layerStyle===St)for(a=this.network.vertexes.iterator;a.next();){b=a.value;c=0===b.angle||180===b.angle;d=-1;for(e=0;e<b.children.length;e++){var f=b.children[e];d=Math.max(d,c?f.width:f.height)}if(0<=d)for(e=0;e<b.children.length;e++)f=
b.children[e],c?(180===b.angle&&(f.focusX+=d-f.width),f.width=d):(270===b.angle&&(f.focusY+=d-f.height),f.height=d)}for(a=this.Qb.iterator;a.next();)b=a.value,b instanceof It&&this.layoutTree(b);this.arrangeTrees();this.updateParts()}this.network=null;this.Qb=new I;this.isValidLayout=!0};function Mt(a){var b=new I;for(a=a.iterator;a.next();){var c=a.value;c.initialized||b.add(c)}return b}
Z.prototype.findRoots=function(){for(var a=this.network.vertexes,b=a.iterator;b.next();){var c=b.value;switch(this.sd){case Dt:0===c.sourceEdges.count&&this.Qb.add(c);break;case Kt:0===c.destinationEdges.count&&this.Qb.add(c);break;default:v("Unhandled path value "+this.sd.toString())}}0===this.Qb.count&&(a=Nt(this,a),null!==a&&this.Qb.add(a))};
function Nt(a,b){var c=999999,d=null;for(b=b.iterator;b.next();){var e=b.value;switch(a.sd){case Dt:e.sourceEdges.count<c&&(c=e.sourceEdges.count,d=e);break;case Kt:e.destinationEdges.count<c&&(c=e.destinationEdges.count,d=e);break;default:v("Unhandled path value "+a.sd.toString())}}return d}
function Lt(a,b){if(null!==b){G&&w(b,It,Z,"walkTree:v");switch(a.sd){case Dt:if(0<b.destinationEdges.count){for(var c=new H,d=b.destinationVertexes;d.next();){var e=d.value;Tt(a,b,e)&&c.add(e)}0<c.count&&(b.children=c.Fa())}break;case Kt:if(0<b.sourceEdges.count){c=new H;for(d=b.sourceVertexes;d.next();)e=d.value,Tt(a,b,e)&&c.add(e);0<c.count&&(b.children=c.Fa())}break;default:v("Unhandled path value"+a.sd.toString())}c=b.children;d=c.length;for(e=0;e<d;e++){var f=c[e];f.initialized=!0;f.level=b.level+
1;f.parent=b;a.Qb.remove(f)}for(b=0;b<d;b++)Lt(a,c[b])}}function Tt(a,b,c){G&&w(b,It,Z,"walkOK:v");G&&w(c,It,Z,"walkOK:c");if(c.initialized){if(null===b)var d=!1;else{G&&w(c,It,Z,"isAncestor:a");G&&w(b,It,Z,"isAncestor:b");for(d=b.parent;null!==d&&d!==c;)d=d.parent;d=d===c}if(d||c.level>b.level)return!1;a.removeChild(c.parent,c)}return!0}
Z.prototype.removeChild=function(a,b){if(null!==a&&null!==b){G&&w(a,It,Z,"removeChild:p");G&&w(b,It,Z,"removeChild:c");for(var c=a.children,d=0,e=0;e<c.length;e++)c[e]===b&&d++;if(0<d){d=Array(c.length-d);for(var f=e=0;f<c.length;f++)c[f]!==b&&(d[e++]=c[f]);a.children=d}}};
function Ot(a,b){if(null!==b){G&&w(b,It,Z,"initializeTree:v");a.initializeTreeVertexValues(b);b.alignment===Ut&&a.sortTreeVertexChildren(b);for(var c=0,d=b.childrenCount,e=0,f=b.children,g=f.length,h=0;h<g;h++){var k=f[h];Ot(a,k);c+=k.descendantCount+1;d=Math.max(d,k.maxChildrenCount);e=Math.max(e,k.maxGenerationCount)}b.descendantCount=c;b.maxChildrenCount=d;b.maxGenerationCount=0<d?e+1:0}}
function Vt(a,b){G&&w(b,It,Z,"mom:v");switch(a.Rp){default:case Et:return null!==b.parent?b.parent:a.Z;case Wt:return null===b.parent?a.Z:null===b.parent.parent?a.$:b.parent;case Xt:return null!==b.parent?null!==b.parent.parent?b.parent.parent:a.$:a.Z;case Yt:var c=!0;if(0===b.childrenCount)c=!1;else for(var d=b.children,e=d.length,f=0;f<e;f++)if(0<d[f].childrenCount){c=!1;break}return c&&null!==b.parent?a.$:null!==b.parent?b.parent:a.Z}}
Z.prototype.initializeTreeVertexValues=function(a){G&&w(a,It,Z,"initializeTreeVertexValues:v");var b=Vt(this,a);a.copyInheritedPropertiesFrom(b);if(null!==a.parent&&a.parent.alignment===Ut){b=a.angle;for(var c=a.parent.children,d=0;d<c.length&&a!==c[d];)d++;0===d%2?d!==c.length-1&&(b=90===b?180:180===b?270:270===b?180:270):b=90===b?0:180===b?90:270===b?0:90;a.angle=b}a.initialized=!0};
function Pt(a,b){if(null!==b){G&&w(b,It,Z,"assignTree:v");a.assignTreeVertexValues(b);b=b.children;for(var c=b.length,d=0;d<c;d++)Pt(a,b[d])}}Z.prototype.assignTreeVertexValues=function(){};function Qt(a,b){if(null!==b){G&&w(b,It,Z,"sortTree:v");b.alignment!==Ut&&a.sortTreeVertexChildren(b);b=b.children;for(var c=b.length,d=0;d<c;d++)Qt(a,b[d])}}
Z.prototype.sortTreeVertexChildren=function(a){G&&w(a,It,Z,"sortTreeVertexChildren:v");switch(a.sorting){case Zt:break;case $t:a.children.reverse();break;case au:a.children.sort(a.comparer);break;case bu:a.children.sort(a.comparer);a.children.reverse();break;default:v("Unhandled sorting value "+a.sorting.toString())}};Z.prototype.Iu=function(){if(this.comments)for(var a=this.network.vertexes.iterator;a.next();)this.addComments(a.value)};
Z.prototype.addComments=function(a){G&&w(a,It,Z,"addComments:v");var b=a.angle,c=a.parent,d=0;var e=!1;null!==c&&(d=c.angle,e=c.alignment,e=cu(e));b=90===b||270===b;d=90===d||270===d;c=0===a.childrenCount;var f=0,g=0,h=0,k=a.commentSpacing;if(null!==a.node)for(var l=a.node.bv();l.next();){var m=l.value;"Comment"===m.category&&m.canLayout()&&(null===a.comments&&(a.comments=[]),a.comments.push(m),m.Ya(),m=m.measuredBounds,b&&!c||!e&&!d&&c||e&&d&&c?(f=Math.max(f,m.width),g+=m.height+Math.abs(h)):(f+=
m.width+Math.abs(h),g=Math.max(g,m.height)),h=k)}null!==a.comments&&(b&&!c||!e&&!d&&c||e&&d&&c?(f+=Math.abs(a.commentMargin),g=Math.max(0,g-a.height)):(g+=Math.abs(a.commentMargin),f=Math.max(0,f-a.width)),e=M.allocAt(0,0,a.bounds.width+f,a.bounds.height+g),a.bounds=e,M.free(e))};function cu(a){return a===du||a===Ut||a===eu||a===fu}function gu(a){return a===du||a===Ut}
function hu(a){G&&w(a,It,Z,"isLeftSideBus:v");var b=a.parent;if(null!==b){var c=b.alignment;if(cu(c)){if(gu(c)){b=b.children;for(c=0;c<b.length&&a!==b[c];)c++;return 0===c%2}if(c===eu)return!0}}return!1}
Z.prototype.layoutComments=function(a){G&&w(a,It,Z,"layoutComments:v");if(null!==a.comments){var b=a.node.measuredBounds,c=a.parent,d=a.angle,e=0;var f=!1;null!==c&&(e=c.angle,f=c.alignment,f=cu(f));d=90===d||270===d;c=90===e||270===e;for(var g=0===a.childrenCount,h=hu(a),k=0,l=a.comments,m=l.length,n=K.alloc(),p=0;p<m;p++){var r=l[p],q=r.measuredBounds;if(d&&!g||!f&&!c&&g||f&&c&&g){if(135<e&&!f||c&&h)if(0<=a.commentMargin)for(n.h(a.bounds.x-a.commentMargin-q.width,a.bounds.y+k),r.move(n),r=r.Nd();r.next();){var u=
r.value;u.fromSpot=ld;u.toSpot=md}else for(n.h(a.bounds.x+2*a.focus.x-a.commentMargin,a.bounds.y+k),r.move(n),r=r.Nd();r.next();)u=r.value,u.fromSpot=md,u.toSpot=ld;else if(0<=a.commentMargin)for(n.h(a.bounds.x+2*a.focus.x+a.commentMargin,a.bounds.y+k),r.move(n),r=r.Nd();r.next();)u=r.value,u.fromSpot=md,u.toSpot=ld;else for(n.h(a.bounds.x+a.commentMargin-q.width,a.bounds.y+k),r.move(n),r=r.Nd();r.next();)u=r.value,u.fromSpot=ld,u.toSpot=md;k=0<=a.commentSpacing?k+(q.height+a.commentSpacing):k+(a.commentSpacing-
q.height)}else{if(135<e&&!f||!c&&h)if(0<=a.commentMargin)for(n.h(a.bounds.x+k,a.bounds.y-a.commentMargin-q.height),r.move(n),r=r.Nd();r.next();)u=r.value,u.fromSpot=kd,u.toSpot=nd;else for(n.h(a.bounds.x+k,a.bounds.y+2*a.focus.y-a.commentMargin),r.move(n),r=r.Nd();r.next();)u=r.value,u.fromSpot=nd,u.toSpot=kd;else if(0<=a.commentMargin)for(n.h(a.bounds.x+k,a.bounds.y+2*a.focus.y+a.commentMargin),r.move(n),r=r.Nd();r.next();)u=r.value,u.fromSpot=nd,u.toSpot=kd;else for(n.h(a.bounds.x+k,a.bounds.y+
a.commentMargin-q.height),r.move(n),r=r.Nd();r.next();)u=r.value,u.fromSpot=kd,u.toSpot=nd;k=0<=a.commentSpacing?k+(q.width+a.commentSpacing):k+(a.commentSpacing-q.width)}}K.free(n);b=k-a.commentSpacing-(d?b.height:b.width);if(this.sd===Dt)for(a=a.destinationEdges;a.next();)e=a.value.link,null===e||e.isAvoiding||(e.fromEndSegmentLength=0<b?b:NaN);else for(a=a.sourceEdges;a.next();)e=a.value.link,null===e||e.isAvoiding||(e.toEndSegmentLength=0<b?b:NaN)}};
Z.prototype.layoutTree=function(a){if(null!==a){G&&w(a,It,Z,"layoutTree:v");for(var b=a.children,c=b.length,d=0;d<c;d++)this.layoutTree(b[d]);switch(a.compaction){case iu:ju(this,a);break;case ku:if(a.alignment===Ut)ju(this,a);else if(G&&w(a,It,Z,"layoutTreeBlock:v"),0===a.childrenCount)d=a.parent,c=!1,b=0,null!==d&&(b=d.angle,c=d.alignment,c=cu(c)),d=hu(a),a.Y.h(0,0),a.Ca.h(a.width,a.height),null===a.parent||null===a.comments||(180!==b&&270!==b||c)&&!d?a.la.h(0,0):180===b&&!c||(90===b||270===b)&&
d?a.la.h(a.width-2*a.focus.x,0):a.la.h(0,a.height-2*a.focus.y),a.tq=null,a.Fq=null;else{var e=lu(a);b=90===e||270===e;var f=0,g=a.children,h=g.length;for(c=0;c<h;c++)d=g[c],f=Math.max(f,b?d.Ca.width:d.Ca.height);var k=a.alignment;d=k===mu;var l=k===ru,m=cu(k),n=Math.max(0,a.breadthLimit);c=su(a);var p=a.nodeSpacing,r=tu(a),q=a.rowSpacing,u=0;if(d||l||a.Fm||a.Gm&&1===a.maxGenerationCount)u=Math.max(0,a.rowIndent);d=a.width;var x=a.height,y=0,z=0,B=0,D=null,C=null,J=0,S=0,T=0,aa=0,W=0,P=0,qa=0,ia=0;
m&&!gu(k)&&135<e&&g.reverse();if(gu(k))if(1<h)for(var Aa=0;Aa<h;Aa++)0===Aa%2&&Aa!==h-1&&(ia=Math.max(ia,b?g[Aa].Ca.width:g[Aa].Ca.height));else 1===h&&(ia=b?g[0].Ca.width:g[0].Ca.height);if(m){switch(k){case du:z=135>e?uu(a,g,ia,y,z):vu(a,g,ia,y,z);ia=z.x;y=z.width;z=z.height;break;case eu:for(D=0;D<h;D++)C=g[D],n=C.Ca,B=0===P?0:q,b?(C.Y.h(f-n.width,aa+B),y=Math.max(y,n.width),z=Math.max(z,aa+B+n.height),aa+=B+n.height):(C.Y.h(T+B,f-n.height),y=Math.max(y,T+B+n.width),z=Math.max(z,n.height),T+=B+
n.width),P++;break;case fu:for(D=0;D<h;D++)C=g[D],f=C.Ca,n=0===P?0:q,b?(C.Y.h(p/2+a.focus.x,aa+n),y=Math.max(y,f.width),z=Math.max(z,aa+n+f.height),aa+=n+f.height):(C.Y.h(T+n,p/2+a.focus.y),y=Math.max(y,T+n+f.width),z=Math.max(z,f.height),T+=n+f.width),P++}D=wu(this,2);C=wu(this,2);b?(D[0].h(0,0),D[1].h(0,z),C[0].h(y,0)):(D[0].h(0,0),D[1].h(y,0),C[0].h(0,z));C[1].h(y,z)}else for(Aa=0;Aa<h;Aa++){var Ma=g[Aa],pb=Ma.Ca;if(b){0<n&&0<P&&T+p+pb.width>n&&(T<f&&xu(a,k,f-T,0,qa,Aa-1),W++,P=0,qa=Aa,B=z,T=0,
aa=135<e?-z-q:z+q);yu(this,Ma,0,aa);var Ya=0;if(0===P){if(D=Ma.tq,C=Ma.Fq,J=pb.width,S=pb.height,null===D||null===C||e!==lu(Ma))D=wu(this,2),C=wu(this,2),D[0].h(0,0),D[1].h(0,S),C[0].h(J,0),C[1].h(J,S)}else{var Ta=Na();S=zu(this,a,Ma,D,C,J,S,Ta);Ya=S.x;D=Ta[0];C=Ta[1];J=S.width;S=S.height;Pa(Ta);T<pb.width&&0>Ya&&(Au(a,-Ya,0,qa,Aa-1),Bu(D,-Ya,0),Bu(C,-Ya,0),Ya=0)}Ma.Y.h(Ya,aa);y=Math.max(y,J);z=Math.max(z,B+(0===W?0:q)+pb.height);T=J}else{0<n&&0<P&&aa+p+pb.height>n&&(aa<f&&xu(a,k,0,f-aa,qa,Aa-1),
W++,P=0,qa=Aa,B=y,aa=0,T=135<e?-y-q:y+q);yu(this,Ma,T,0);Ya=0;if(0===P){if(D=Ma.tq,C=Ma.Fq,J=pb.width,S=pb.height,null===D||null===C||e!==lu(Ma))D=wu(this,2),C=wu(this,2),D[0].h(0,0),D[1].h(J,0),C[0].h(0,S),C[1].h(J,S)}else Ta=Na(),S=zu(this,a,Ma,D,C,J,S,Ta),Ya=S.x,D=Ta[0],C=Ta[1],J=S.width,S=S.height,Pa(Ta),aa<pb.height&&0>Ya&&(Au(a,0,-Ya,qa,Aa-1),Bu(D,0,-Ya),Bu(C,0,-Ya),Ya=0);Ma.Y.h(T,Ya);z=Math.max(z,S);y=Math.max(y,B+(0===W?0:q)+pb.width);aa=S}P++}0<W&&(b?(z+=Math.max(0,c),T<y&&xu(a,k,y-T,0,qa,
h-1),0<u&&(l||Au(a,u,0,0,h-1),y+=u)):(y+=Math.max(0,c),aa<z&&xu(a,k,0,z-aa,qa,h-1),0<u&&(l||Au(a,0,u,0,h-1),z+=u)));u=l=0;switch(k){case Cu:b?l+=y/2-a.focus.x-r/2:u+=z/2-a.focus.y-r/2;break;case Du:0<W?b?l+=y/2-a.focus.x-r/2:u+=z/2-a.focus.y-r/2:b?(ia=g[0].Y.x+g[0].la.x,l+=ia+(g[h-1].Y.x+g[h-1].la.x+2*g[h-1].focus.x-ia)/2-a.focus.x-r/2):(ia=g[0].Y.y+g[0].la.y,u+=ia+(g[h-1].Y.y+g[h-1].la.y+2*g[h-1].focus.y-ia)/2-a.focus.y-r/2);break;case mu:b?(l-=r,y+=r):(u-=r,z+=r);break;case ru:b?(l+=y-a.width+r,
y+=r):(u+=z-a.height+r,z+=r);break;case du:b?1<h?l+=ia+p/2-a.focus.x:l+=g[0].focus.x-a.focus.x+g[0].la.x:1<h?u+=ia+p/2-a.focus.y:u+=g[0].focus.y-a.focus.y+g[0].la.y;break;case eu:b?l+=y+p/2-a.focus.x:u+=z+p/2-a.focus.y;break;case fu:break;default:v("Unhandled alignment value "+k.toString())}for(r=0;r<h;r++)ia=g[r],b?ia.Y.h(ia.Y.x+ia.la.x-l,ia.Y.y+(135<e?(m?-z:-ia.Ca.height)+ia.la.y-c:x+c+ia.la.y)):ia.Y.h(ia.Y.x+(135<e?(m?-y:-ia.Ca.width)+ia.la.x-c:d+c+ia.la.x),ia.Y.y+ia.la.y-u);h=g=0;m?b?(y=Eu(a,
y,l),0>l&&(l=0),135<e&&(u+=z+c),z+=x+c,k===fu&&(g+=p/2+a.focus.x),h+=x+c):(135<e&&(l+=y+c),y+=d+c,z=Fu(a,z,u),0>u&&(u=0),k===fu&&(h+=p/2+a.focus.y),g+=d+c):b?(null===a.comments?d>y&&(y=Gu(k,d-y,0),g=y.x,h=y.y,y=d,l=0):y=Eu(a,y,l),0>l&&(g-=l,l=0),135<e&&(u+=z+c),z=Math.max(Math.max(z,x),z+x+c),h+=x+c):(135<e&&(l+=y+c),y=Math.max(Math.max(y,d),y+d+c),null===a.comments?x>z&&(z=Gu(k,0,x-z),g=z.x,h=z.y,z=x,u=0):z=Fu(a,z,u),0>u&&(h-=u,u=0),g+=d+c);if(0<W)e=wu(this,4),W=wu(this,4),b?(e[2].h(0,x+c),e[3].h(e[2].x,
z),W[2].h(y,e[2].y),W[3].h(W[2].x,e[3].y)):(e[2].h(d+c,0),e[3].h(y,e[2].y),W[2].h(e[2].x,z),W[3].h(e[3].x,W[2].y));else{e=wu(this,D.length+2);W=wu(this,C.length+2);for(k=0;k<D.length;k++)m=D[k],e[k+2].h(m.x+g,m.y+h);for(k=0;k<C.length;k++)m=C[k],W[k+2].h(m.x+g,m.y+h)}b?(e[0].h(l,0),e[1].h(e[0].x,x),e[2].y<e[1].y&&(e[2].x>e[0].x?e[2].assign(e[1]):e[1].assign(e[2])),e[3].y<e[2].y&&(e[3].x>e[0].x?e[3].assign(e[2]):e[2].assign(e[3])),W[0].h(l+d,0),W[1].h(W[0].x,x),W[2].y<W[1].y&&(W[2].x<W[0].x?W[2].assign(W[1]):
W[1].assign(W[2])),W[3].y<W[2].y&&(W[3].x<W[0].x?W[3].assign(W[2]):W[2].assign(W[3])),e[2].y-=c/2,W[2].y-=c/2):(e[0].h(0,u),e[1].h(d,e[0].y),e[2].x<e[1].x&&(e[2].y>e[0].y?e[2].assign(e[1]):e[1].assign(e[2])),e[3].x<e[2].x&&(e[3].y>e[0].y?e[3].assign(e[2]):e[2].assign(e[3])),W[0].h(0,u+x),W[1].h(d,W[0].y),W[2].x<W[1].x&&(W[2].y<W[0].y?W[2].assign(W[1]):W[1].assign(W[2])),W[3].x<W[2].x&&(W[3].y<W[0].y?W[3].assign(W[2]):W[2].assign(W[3])),e[2].x-=c/2,W[2].x-=c/2);Hu(this,D);Hu(this,C);a.tq=e;a.Fq=W;
a.la.h(l,u);a.Ca.h(y,z)}break;default:v("Unhandled compaction value "+a.compaction.toString())}}};
function ju(a,b){G&&w(b,It,Z,"layoutTreeNone:v");if(0===b.childrenCount){var c=!1,d=0;null!==b.parent&&(d=b.parent.angle,c=b.parent.alignment,c=cu(c));var e=hu(b);b.Y.h(0,0);b.Ca.h(b.width,b.height);null===b.parent||null===b.comments||(180!==d&&270!==d||c)&&!e?b.la.h(0,0):180===d&&!c||(90===d||270===d)&&e?b.la.h(b.width-2*b.focus.x,0):b.la.h(0,b.height-2*b.focus.y)}else{d=lu(b);c=90===d||270===d;var f=0;e=b.children;for(var g=e.length,h=0;h<g;h++){var k=e[h];f=Math.max(f,c?k.Ca.width:k.Ca.height)}var l=
b.alignment,m=l===mu,n=l===ru;h=cu(l);var p=Math.max(0,b.breadthLimit);k=su(b);var r=b.nodeSpacing,q=tu(b),u=m||n?0:q/2,x=b.rowSpacing,y=0;if(m||n||b.Fm||b.Gm&&1===b.maxGenerationCount)y=Math.max(0,b.rowIndent);m=b.width;var z=b.height,B=0,D=0,C=0,J=0,S=0,T=0,aa=0,W=0,P=0,qa=0;h&&!gu(l)&&135<d&&e.reverse();if(gu(l))if(1<g)for(var ia=0;ia<g;ia++){var Aa=e[ia],Ma=Aa.Ca;0===ia%2&&ia!==g-1?P=Math.max(P,(c?Ma.width:Ma.height)+Iu(Aa)-r):0!==ia%2&&(qa=Math.max(qa,(c?Ma.width:Ma.height)+Iu(Aa)-r))}else 1===
g&&(P=c?e[0].Ca.width:e[0].Ca.height);if(h)switch(l){case du:case Ut:D=135>d?uu(b,e,P,B,D):vu(b,e,P,B,D);P=D.x;B=D.width;D=D.height;break;case eu:for(a=0;a<g;a++)p=e[a],u=p.Ca,C=0===aa?0:x,c?(p.Y.h(f-u.width,S+C),B=Math.max(B,u.width),D=Math.max(D,S+C+u.height),S+=C+u.height):(p.Y.h(J+C,f-u.height),B=Math.max(B,J+C+u.width),D=Math.max(D,u.height),J+=C+u.width),aa++;break;case fu:for(f=0;f<g;f++)a=e[f],p=a.Ca,u=0===aa?0:x,c?(a.Y.h(r/2+b.focus.x,S+u),B=Math.max(B,p.width),D=Math.max(D,S+u+p.height),
S+=u+p.height):(a.Y.h(J+u,r/2+b.focus.y),B=Math.max(B,J+u+p.width),D=Math.max(D,p.height),J+=u+p.width),aa++}else for(qa=0;qa<g;qa++)ia=e[qa],Aa=ia.Ca,c?(0<p&&0<aa&&J+r+Aa.width>p&&(J<f&&xu(b,l,f-J,0,W,qa-1),T++,aa=0,W=qa,C=D,J=0,S=135<d?-D-x:D+x),Ma=0===aa?u:r,yu(a,ia,0,S),ia.Y.h(J+Ma,S),B=Math.max(B,J+Ma+Aa.width),D=Math.max(D,C+(0===T?0:x)+Aa.height),J+=Ma+Aa.width):(0<p&&0<aa&&S+r+Aa.height>p&&(S<f&&xu(b,l,0,f-S,W,qa-1),T++,aa=0,W=qa,C=B,S=0,J=135<d?-B-x:B+x),Ma=0===aa?u:r,yu(a,ia,J,0),ia.Y.h(J,
S+Ma),D=Math.max(D,S+Ma+Aa.height),B=Math.max(B,C+(0===T?0:x)+Aa.width),S+=Ma+Aa.height),aa++;0<T&&(c?(D+=Math.max(0,k),J<B&&xu(b,l,B-J,0,W,g-1),0<y&&(n||Au(b,y,0,0,g-1),B+=y)):(B+=Math.max(0,k),S<D&&xu(b,l,0,D-S,W,g-1),0<y&&(n||Au(b,0,y,0,g-1),D+=y)));y=n=0;switch(l){case Cu:c?n+=B/2-b.focus.x-q/2:y+=D/2-b.focus.y-q/2;break;case Du:0<T?c?n+=B/2-b.focus.x-q/2:y+=D/2-b.focus.y-q/2:c?(l=e[0].Y.x+e[0].la.x,n+=l+(e[g-1].Y.x+e[g-1].la.x+2*e[g-1].focus.x-l)/2-b.focus.x-q/2):(l=e[0].Y.y+e[0].la.y,y+=l+(e[g-
1].Y.y+e[g-1].la.y+2*e[g-1].focus.y-l)/2-b.focus.y-q/2);break;case mu:c?(n-=q,B+=q):(y-=q,D+=q);break;case ru:c?(n+=B-b.width+q,B+=q):(y+=D-b.height+q,D+=q);break;case du:case Ut:c?1<g?n+=P+r/2-b.focus.x:n+=e[0].focus.x-b.focus.x+e[0].la.x:1<g?y+=P+r/2-b.focus.y:y+=e[0].focus.y-b.focus.y+e[0].la.y;break;case eu:c?n+=B+r/2-b.focus.x:y+=D+r/2-b.focus.y;break;case fu:break;default:v("Unhandled alignment value "+l.toString())}for(q=0;q<g;q++)l=e[q],c?l.Y.h(l.Y.x+l.la.x-n,l.Y.y+(135<d?(h?-D:-l.Ca.height)+
l.la.y-k:z+k+l.la.y)):l.Y.h(l.Y.x+(135<d?(h?-B:-l.Ca.width)+l.la.x-k:m+k+l.la.x),l.Y.y+l.la.y-y);c?(B=Eu(b,B,n),0>n&&(n=0),135<d&&(y+=D+k),D=Math.max(Math.max(D,z),D+z+k)):(135<d&&(n+=B+k),B=Math.max(Math.max(B,m),B+m+k),D=Fu(b,D,y),0>y&&(y=0));b.la.h(n,y);b.Ca.h(B,D)}}
function uu(a,b,c,d,e){G&&w(a,It,Z,"layoutBusChildrenPosDir:v");var f=b.length;if(0===f)return new M(c,0,d,e);if(1===f)return a=b[0],d=a.Ca.width,e=a.Ca.height,new M(c,0,d,e);for(var g=a.nodeSpacing,h=a.rowSpacing,k=90===lu(a),l=0,m=0,n=0,p=0;p<f;p++)if(!(0!==p%2||1<f&&p===f-1)){var r=b[p],q=r.Ca,u=0===l?0:h;if(k){var x=Iu(r)-g;r.Y.h(c-(q.width+x),n+u);d=Math.max(d,q.width+x);e=Math.max(e,n+u+q.height);n+=u+q.height}else x=Iu(r)-g,r.Y.h(m+u,c-(q.height+x)),e=Math.max(e,q.height+x),d=Math.max(d,m+
u+q.width),m+=u+q.width;l++}l=0;r=m;p=n;k?(m=c+g,n=0):(m=0,n=c+g);for(q=0;q<f;q++)if(0!==q%2){u=b[q];x=u.Ca;var y=0===l?0:h;if(k){var z=Iu(u)-g;u.Y.h(m+z,n+y);d=Math.max(d,m+x.width+z);e=Math.max(e,n+y+x.height);n+=y+x.height}else z=Iu(u)-g,u.Y.h(m+y,n+z),d=Math.max(d,m+y+x.width),e=Math.max(e,n+x.height+z),m+=y+x.width;l++}1<f&&1===f%2&&(b=b[f-1],f=b.Ca,h=Ju(b),k?(b.Y.h(c+g/2-b.focus.x-b.la.x,e+h),k=c+g/2-b.focus.x-b.la.x,d=Math.max(d,k+f.width),0>k&&(d-=k),e=Math.max(e,Math.max(p,n)+h+f.height),
0>b.Y.x&&(c=Ku(a,b.Y.x,!1,c,g))):(b.Y.h(d+h,c+g/2-b.focus.y-b.la.y),d=Math.max(d,Math.max(r,m)+h+f.width),n=c+g/2-b.focus.y-b.la.y,e=Math.max(e,n+f.height),0>n&&(e-=n),0>b.Y.y&&(c=Ku(a,b.Y.y,!0,c,g))));return new M(c,0,d,e)}
function vu(a,b,c,d,e){G&&w(a,It,Z,"layoutBusChildrenNegDir:v");var f=b.length;if(0===f)return new M(c,0,d,e);if(1===f)return b=b[0],d=b.Ca.width,e=b.Ca.height,new M(c,0,d,e);for(var g=a.nodeSpacing,h=a.rowSpacing,k=270===lu(a),l=0,m=0,n=0,p=0;p<f;p++)if(!(0!==p%2||1<f&&p===f-1)){var r=b[p],q=r.Ca,u=0===l?0:h;if(k){var x=Iu(r)-g;n-=u+q.height;r.Y.h(c-(q.width+x),n);d=Math.max(d,q.width+x);e=Math.max(e,Math.abs(n))}else x=Iu(r)-g,m-=u+q.width,r.Y.h(m,c-(q.height+x)),e=Math.max(e,q.height+x),d=Math.max(d,
Math.abs(m));l++}l=0;r=m;p=n;k?(m=c+g,n=0):(m=0,n=c+g);for(q=0;q<f;q++)if(0!==q%2){u=b[q];x=u.Ca;var y=0===l?0:h;if(k){var z=Iu(u)-g;n-=y+x.height;u.Y.h(m+z,n);d=Math.max(d,m+x.width+z);e=Math.max(e,Math.abs(n))}else z=Iu(u)-g,m-=y+x.width,u.Y.h(m,n+z),e=Math.max(e,n+x.height+z),d=Math.max(d,Math.abs(m));l++}1<f&&1===f%2&&(h=b[f-1],l=h.Ca,q=Ju(h),k?(h.Y.h(c+g/2-h.focus.x-h.la.x,-e-l.height-q),m=c+g/2-h.focus.x-h.la.x,d=Math.max(d,m+l.width),0>m&&(d-=m),e=Math.max(e,Math.abs(Math.min(p,n))+q+l.height),
0>h.Y.x&&(c=Ku(a,h.Y.x,!1,c,g))):(h.Y.h(-d-l.width-q,c+g/2-h.focus.y-h.la.y),d=Math.max(d,Math.abs(Math.min(r,m))+q+l.width),n=c+g/2-h.focus.y-h.la.y,e=Math.max(e,n+l.height),0>n&&(e-=n),0>h.Y.y&&(c=Ku(a,h.Y.y,!0,c,g))));for(a=0;a<f;a++)g=b[a],k?g.Y.h(g.Y.x,g.Y.y+e):g.Y.h(g.Y.x+d,g.Y.y);return new M(c,0,d,e)}function Iu(a){G&&w(a,It,Z,"fixRelativePostions:child");return null===a.parent?0:a.parent.nodeSpacing}
function Ju(a){G&&w(a,It,Z,"fixRelativePostions:lastchild");return null===a.parent?0:a.parent.rowSpacing}function Ku(a,b,c,d,e){G&&w(a,It,Z,"fixRelativePostions:v");a=a.children;for(var f=a.length,g=0;g<f;g++)c?a[g].Y.h(a[g].Y.x,a[g].Y.y-b):a[g].Y.h(a[g].Y.x-b,a[g].Y.y);b=a[f-1];return Math.max(d,c?b.la.y+b.focus.y-e/2:b.la.x+b.focus.x-e/2)}
function Eu(a,b,c){G&&w(a,It,Z,"calculateSubwidth:v");switch(a.alignment){case Du:case Cu:return c+a.width>b&&(b=c+a.width),0>c&&(b-=c),b;case mu:return a.width>b?a.width:b;case ru:return 2*a.focus.x>b?a.width:b+a.width-2*a.focus.x;case du:case Ut:return Math.max(a.width,Math.max(b,c+a.width)-Math.min(0,c));case eu:return a.width-a.focus.x+a.nodeSpacing/2+b;case fu:return Math.max(a.width,a.focus.x+a.nodeSpacing/2+b);default:return b}}
function Fu(a,b,c){G&&w(a,It,Z,"calculateSubheight:v");switch(a.alignment){case Du:case Cu:return c+a.height>b&&(b=c+a.height),0>c&&(b-=c),b;case mu:return a.height>b?a.height:b;case ru:return 2*a.focus.y>b?a.height:b+a.height-2*a.focus.y;case du:case Ut:return Math.max(a.height,Math.max(b,c+a.height)-Math.min(0,c));case eu:return a.height-a.focus.y+a.nodeSpacing/2+b;case fu:return Math.max(a.height,a.focus.y+a.nodeSpacing/2+b);default:return b}}
function Gu(a,b,c){G&&w(a,F,Z,"alignOffset:align");switch(a){case Cu:b/=2;c/=2;break;case Du:b/=2;c/=2;break;case mu:c=b=0;break;case ru:break;default:v("Unhandled alignment value "+a.toString())}return new K(b,c)}function xu(a,b,c,d,e,f){G&&w(a,It,Z,"shiftRelPosAlign:v");G&&w(b,F,Z,"shiftRelPosAlign:align");b=Gu(b,c,d);Au(a,b.x,b.y,e,f)}function Au(a,b,c,d,e){G&&w(a,It,Z,"shiftRelPos:v");if(0!==b||0!==c)for(a=a.children;d<=e;d++){var f=a[d].Y;f.x+=b;f.y+=c}}
function yu(a,b,c,d){G&&(w(b,It,Z,"recordMidPoints:v"),A(c,"number",Z,"recordMidPoints:x"),A(d,"number",Z,"recordMidPoints:y"));var e=b.parent;switch(a.sd){case Dt:for(a=b.sourceEdges;a.next();)b=a.value,b.fromVertex===e&&b.relativePoint.h(c,d);break;case Kt:for(a=b.destinationEdges;a.next();)b=a.value,b.toVertex===e&&b.relativePoint.h(c,d);break;default:v("Unhandled path value "+a.sd.toString())}}function Bu(a,b,c){for(var d=0;d<a.length;d++){var e=a[d];e.x+=b;e.y+=c}}
function zu(a,b,c,d,e,f,g,h){G&&w(b,It,Z,"mergeFringes:parent");G&&w(c,It,Z,"mergeFringes:child");var k=lu(b),l=90===k||270===k,m=b.nodeSpacing;b=d;var n=e;d=f;var p=g,r=c.tq,q=c.Fq;g=c.Ca;var u=l?Math.max(p,g.height):Math.max(d,g.width);if(null===r||k!==lu(c))r=wu(a,2),q=wu(a,2),l?(r[0].h(0,0),r[1].h(0,g.height),q[0].h(g.width,0),q[1].h(q[0].x,r[1].y)):(r[0].h(0,0),r[1].h(g.width,0),q[0].h(0,g.height),q[1].h(r[1].x,q[0].y));if(l){p=9999999;if(!(null===n||2>n.length||null===r||2>r.length))for(e=c=
0;c<n.length&&e<r.length;){f=n[c];var x=r[e];k=x.x;l=x.y;k+=d;var y=f;c+1<n.length&&(y=n[c+1]);var z=x;x=z.x;z=z.y;e+1<r.length&&(z=r[e+1],x=z.x,z=z.y,x+=d);var B=p;f.y===l?B=k-f.x:f.y>l&&f.y<z?B=k+(f.y-l)/(z-l)*(x-k)-f.x:l>f.y&&l<y.y&&(B=k-(f.x+(l-f.y)/(y.y-f.y)*(y.x-f.x)));B<p&&(p=B);y.y<=f.y?c++:z<=l?e++:(y.y<=z&&c++,z<=y.y&&e++)}p=d-p;p+=m;c=r;e=p;if(null===b||2>b.length||null===c||2>c.length)d=null;else{m=wu(a,b.length+c.length);for(d=f=k=0;f<c.length&&c[f].y<b[0].y;)l=c[f++],m[d++].h(l.x+e,
l.y);for(;k<b.length;)l=b[k++],m[d++].h(l.x,l.y);for(k=b[b.length-1].y;f<c.length&&c[f].y<=k;)f++;for(;f<c.length&&c[f].y>k;)l=c[f++],m[d++].h(l.x+e,l.y);c=wu(a,d);for(k=0;k<d;k++)c[k].assign(m[k]);Hu(a,m);d=c}f=q;k=p;if(null===n||2>n.length||null===f||2>f.length)e=null;else{m=wu(a,n.length+f.length);for(e=l=c=0;c<n.length&&n[c].y<f[0].y;)y=n[c++],m[e++].h(y.x,y.y);for(;l<f.length;)y=f[l++],m[e++].h(y.x+k,y.y);for(f=f[f.length-1].y;c<n.length&&n[c].y<=f;)c++;for(;c<n.length&&n[c].y>f;)k=n[c++],m[e++].h(k.x,
k.y);f=wu(a,e);for(c=0;c<e;c++)f[c].assign(m[c]);Hu(a,m);e=f}f=Math.max(0,p)+g.width;g=u;Hu(a,b);Hu(a,r);Hu(a,n);Hu(a,q);h[0]=d;h[1]=e;return new M(p,0,f,g)}d=9999999;if(!(null===n||2>n.length||null===r||2>r.length))for(e=c=0;c<n.length&&e<r.length;)f=n[c],x=r[e],k=x.x,l=x.y,l+=p,y=f,c+1<n.length&&(y=n[c+1]),z=x,x=z.x,z=z.y,e+1<r.length&&(z=r[e+1],x=z.x,z=z.y,z+=p),B=d,f.x===k?B=l-f.y:f.x>k&&f.x<x?B=l+(f.x-k)/(x-k)*(z-l)-f.y:k>f.x&&k<y.x&&(B=l-(f.y+(k-f.x)/(y.x-f.x)*(y.y-f.y))),B<d&&(d=B),y.x<=f.x?
c++:x<=k?e++:(y.x<=x&&c++,x<=y.x&&e++);p-=d;p+=m;c=r;e=p;if(null===b||2>b.length||null===c||2>c.length)d=null;else{m=wu(a,b.length+c.length);for(d=f=k=0;f<c.length&&c[f].x<b[0].x;)l=c[f++],m[d++].h(l.x,l.y+e);for(;k<b.length;)l=b[k++],m[d++].h(l.x,l.y);for(k=b[b.length-1].x;f<c.length&&c[f].x<=k;)f++;for(;f<c.length&&c[f].x>k;)l=c[f++],m[d++].h(l.x,l.y+e);c=wu(a,d);for(k=0;k<d;k++)c[k].assign(m[k]);Hu(a,m);d=c}f=q;k=p;if(null===n||2>n.length||null===f||2>f.length)e=null;else{m=wu(a,n.length+f.length);
for(e=l=c=0;c<n.length&&n[c].x<f[0].x;)y=n[c++],m[e++].h(y.x,y.y);for(;l<f.length;)y=f[l++],m[e++].h(y.x,y.y+k);for(f=f[f.length-1].x;c<n.length&&n[c].x<=f;)c++;for(;c<n.length&&n[c].x>f;)k=n[c++],m[e++].h(k.x,k.y);f=wu(a,e);for(c=0;c<e;c++)f[c].assign(m[c]);Hu(a,m);e=f}f=u;g=Math.max(0,p)+g.height;Hu(a,b);Hu(a,r);Hu(a,n);Hu(a,q);h[0]=d;h[1]=e;return new M(p,0,f,g)}function wu(a,b){a=a.xu[b];if(void 0!==a&&(a=a.pop(),void 0!==a))return a;a=[];for(var c=0;c<b;c++)a[c]=new K;return a}
function Hu(a,b){var c=b.length,d=a.xu[c];void 0===d&&(d=[],a.xu[c]=d);d.push(b)}
Z.prototype.arrangeTrees=function(){if(this.Nb===Jt)for(var a=this.Qb.iterator;a.next();){var b=a.value;if(b instanceof It){var c=b.node;if(null!==c){var d=c.position;c=d.x;d=d.y;isFinite(c)||(c=0);isFinite(d)||(d=0);Lu(this,b,c,d)}}}else{a=[];for(b=this.Qb.iterator;b.next();)c=b.value,c instanceof It&&a.push(c);switch(this.sorting){case Zt:break;case $t:a.reverse();break;case au:a.sort(this.comparer);break;case bu:a.sort(this.comparer);a.reverse();break;default:v("Unhandled sorting value "+this.sorting.toString())}c=
this.arrangementOrigin;b=c.x;c=c.y;for(d=0;d<a.length;d++){var e=a[d];Lu(this,e,b+e.la.x,c+e.la.y);switch(this.Nb){case Gt:c+=e.Ca.height+this.Wd.height;break;case Mu:b+=e.Ca.width+this.Wd.width;break;default:v("Unhandled arrangement value "+this.Nb.toString())}}}};function Lu(a,b,c,d){if(null!==b){G&&w(b,It,Z,"assignAbsolutePositions:v");b.x=c;b.y=d;b=b.children;for(var e=b.length,f=0;f<e;f++){var g=b[f];Lu(a,g,c+g.Y.x,d+g.Y.y)}}}
Z.prototype.commitLayout=function(){this.Wv();this.commitNodes();this.Ou();this.isRouting&&this.commitLinks()};Z.prototype.commitNodes=function(){for(var a=this.network.vertexes.iterator;a.next();)a.value.commit();for(a.reset();a.next();)this.layoutComments(a.value)};
Z.prototype.Ou=function(){if(this.layerStyle===Rt){for(var a=this.Ow,b=[],c=null,d=this.network.vertexes.iterator;d.next();){var e=d.value;null===c?c=e.bounds.copy():c.Xc(e.bounds);var f=b[e.level];void 0===f?f=su(e):f=Math.max(f,su(e));b[e.level]=f}for(d=0;d<b.length;d++)void 0===b[d]&&(b[d]=0);90===this.angle||270===this.angle?(c.Qc(this.nodeSpacing/2,this.layerSpacing),d=new K(-this.nodeSpacing/2,-this.layerSpacing/2)):(c.Qc(this.layerSpacing,this.nodeSpacing/2),d=new K(-this.layerSpacing/2,-this.nodeSpacing/
2));e=[];c=90===this.angle||270===this.angle?c.width:c.height;f=0;if(180===this.angle||270===this.angle)for(var g=0;g<a.length;g++)f+=a[g]+b[g];for(g=0;g<a.length;g++){var h=a[g]+b[g];270===this.angle?(f-=h,e.push(new M(0,f,c,h))):90===this.angle?(e.push(new M(0,f,c,h)),f+=h):180===this.angle?(f-=h,e.push(new M(f,0,h,c))):(e.push(new M(f,0,h,c)),f+=h)}this.commitLayers(e,d)}};Z.prototype.commitLayers=function(){};Z.prototype.commitLinks=function(){for(var a=this.network.edges.iterator;a.next();)a.value.commit()};
Z.prototype.Wv=function(){for(var a=this.Qb.iterator;a.next();){var b=a.value;b instanceof It&&Nu(this,b)}};function Nu(a,b){if(null!==b){G&&w(b,It,Z,"setPortSpotsTree:v");a.setPortSpots(b);b=b.children;for(var c=b.length,d=0;d<c;d++)Nu(a,b[d])}}
Z.prototype.setPortSpots=function(a){G&&w(a,It,Z,"setPortSpots:v");var b=a.alignment;if(cu(b)){G&&w(a,It,Z,"setPortSpotsBus:v");G&&w(b,F,Z,"setPortSpots:align");var c=this.sd===Dt,d=lu(a);switch(d){case 0:var e=md;break;case 90:e=nd;break;case 180:e=ld;break;default:e=kd}var f=a.children,g=f.length;switch(b){case du:case Ut:for(b=0;b<g;b++){var h=f[b];h=(c?h.sourceEdges:h.destinationEdges).first();if(null!==h&&(h=h.link,null!==h)){var k=90===d||270===d?ld:kd;if(1===g||b===g-1&&1===g%2)switch(d){case 0:k=
ld;break;case 90:k=kd;break;case 180:k=md;break;default:k=nd}else 0===b%2&&(k=90===d||270===d?md:nd);c?(a.setsPortSpot&&(h.fromSpot=e),a.setsChildPortSpot&&(h.toSpot=k)):(a.setsPortSpot&&(h.fromSpot=k),a.setsChildPortSpot&&(h.toSpot=e))}}break;case eu:d=90===d||270===d?md:nd;for(f=c?a.destinationEdges:a.sourceEdges;f.next();)g=f.value.link,null!==g&&(c?(a.setsPortSpot&&(g.fromSpot=e),a.setsChildPortSpot&&(g.toSpot=d)):(a.setsPortSpot&&(g.fromSpot=d),a.setsChildPortSpot&&(g.toSpot=e)));break;case fu:for(d=
90===d||270===d?ld:kd,f=c?a.destinationEdges:a.sourceEdges;f.next();)g=f.value.link,null!==g&&(c?(a.setsPortSpot&&(g.fromSpot=e),a.setsChildPortSpot&&(g.toSpot=d)):(a.setsPortSpot&&(g.fromSpot=d),a.setsChildPortSpot&&(g.toSpot=e)))}}else if(c=lu(a),this.sd===Dt)for(e=a.destinationEdges;e.next();){if(d=e.value.link,null!==d){if(a.setsPortSpot)if(a.portSpot.Kb())switch(c){case 0:d.fromSpot=md;break;case 90:d.fromSpot=nd;break;case 180:d.fromSpot=ld;break;default:d.fromSpot=kd}else d.fromSpot=a.portSpot;
if(a.setsChildPortSpot)if(a.childPortSpot.Kb())switch(c){case 0:d.toSpot=ld;break;case 90:d.toSpot=kd;break;case 180:d.toSpot=md;break;default:d.toSpot=nd}else d.toSpot=a.childPortSpot}}else for(e=a.sourceEdges;e.next();)if(d=e.value.link,null!==d){if(a.setsPortSpot)if(a.portSpot.Kb())switch(c){case 0:d.toSpot=md;break;case 90:d.toSpot=nd;break;case 180:d.toSpot=ld;break;default:d.toSpot=kd}else d.toSpot=a.portSpot;if(a.setsChildPortSpot)if(a.childPortSpot.Kb())switch(c){case 0:d.fromSpot=ld;break;
case 90:d.fromSpot=kd;break;case 180:d.fromSpot=md;break;default:d.fromSpot=nd}else d.fromSpot=a.childPortSpot}};function lu(a){a=a.angle;return 45>=a?0:135>=a?90:225>=a?180:315>=a?270:0}function su(a){G&&w(a,It,Z,"computeLayerSpacing:v");var b=lu(a);b=90===b||270===b;var c=a.layerSpacing;if(0<a.layerSpacingParentOverlap){var d=Math.min(1,a.layerSpacingParentOverlap);c-=b?a.height*d:a.width*d}c<(b?-a.height:-a.width)&&(c=b?-a.height:-a.width);return c}
function tu(a){G&&w(a,It,Z,"computeNodeIndent:v");var b=lu(a),c=a.nodeIndent;if(0<a.nodeIndentPastParent){var d=Math.min(1,a.nodeIndentPastParent);c+=90===b||270===b?a.width*d:a.height*d}return c=Math.max(0,c)}
na.Object.defineProperties(Z.prototype,{roots:{configurable:!0,get:function(){return this.Qb},set:function(a){this.Qb!==a&&(w(a,I,Z,"roots"),this.Qb=a,this.C())}},path:{configurable:!0,get:function(){return this.Zo},set:function(a){this.Zo!==a&&(db(a,Z,Z,"path"),this.Zo=a,this.C())}},treeStyle:{configurable:!0,get:function(){return this.Rp},set:function(a){this.Nb!==a&&(db(a,Z,Z,"treeStyle"),a===Et||a===Xt||a===Yt||a===Wt)&&(this.Rp=a,this.C())}},layerStyle:{configurable:!0,
enumerable:!0,get:function(){return this.Gr},set:function(a){this.Nb!==a&&(db(a,Z,Z,"layerStyle"),a===Ft||a===St||a===Rt)&&(this.Gr=a,this.C())}},comments:{configurable:!0,get:function(){return this.qd},set:function(a){this.qd!==a&&(A(a,"boolean",Z,"comments"),this.qd=a,this.C())}},arrangement:{configurable:!0,get:function(){return this.Nb},set:function(a){this.Nb!==a&&(db(a,Z,Z,"arrangement"),a===Gt||a===Mu||a===Jt)&&(this.Nb=a,this.C())}},arrangementSpacing:{configurable:!0,
enumerable:!0,get:function(){return this.Wd},set:function(a){w(a,Hb,Z,"arrangementSpacing");this.Wd.B(a)||(this.Wd.assign(a),this.C())}},rootDefaults:{configurable:!0,get:function(){return this.Z},set:function(a){this.Z!==a&&(w(a,It,Z,"rootDefaults"),this.Z=a,this.C())}},alternateDefaults:{configurable:!0,get:function(){return this.$},set:function(a){this.$!==a&&(w(a,It,Z,"alternateDefaults"),this.$=a,this.C())}},sorting:{configurable:!0,get:function(){return this.Z.sorting},
set:function(a){this.Z.sorting!==a&&(db(a,Z,Z,"sorting"),a===Zt||a===$t||a===au||bu)&&(this.Z.sorting=a,this.C())}},comparer:{configurable:!0,get:function(){return this.Z.comparer},set:function(a){this.Z.comparer!==a&&(A(a,"function",Z,"comparer"),this.Z.comparer=a,this.C())}},angle:{configurable:!0,get:function(){return this.Z.angle},set:function(a){this.Z.angle!==a&&(A(a,"number",Z,"angle"),0===a||90===a||180===a||270===a?(this.Z.angle=a,this.C()):v("TreeLayout.angle must be 0, 90, 180, or 270"))}},
alignment:{configurable:!0,get:function(){return this.Z.alignment},set:function(a){this.Z.alignment!==a&&(db(a,Z,Z,"alignment"),this.Z.alignment=a,this.C())}},nodeIndent:{configurable:!0,get:function(){return this.Z.nodeIndent},set:function(a){this.Z.nodeIndent!==a&&(A(a,"number",Z,"nodeIndent"),0<=a&&(this.Z.nodeIndent=a,this.C()))}},nodeIndentPastParent:{configurable:!0,get:function(){return this.Z.nodeIndentPastParent},set:function(a){this.Z.nodeIndentPastParent!==
a&&(A(a,"number",Z,"nodeIndentPastParent"),0<=a&&1>=a&&(this.Z.nodeIndentPastParent=a,this.C()))}},nodeSpacing:{configurable:!0,get:function(){return this.Z.nodeSpacing},set:function(a){this.Z.nodeSpacing!==a&&(A(a,"number",Z,"nodeSpacing"),this.Z.nodeSpacing=a,this.C())}},layerSpacing:{configurable:!0,get:function(){return this.Z.layerSpacing},set:function(a){this.Z.layerSpacing!==a&&(A(a,"number",Z,"layerSpacing"),this.Z.layerSpacing=a,this.C())}},layerSpacingParentOverlap:{configurable:!0,
enumerable:!0,get:function(){return this.Z.layerSpacingParentOverlap},set:function(a){this.Z.layerSpacingParentOverlap!==a&&(A(a,"number",Z,"layerSpacingParentOverlap"),0<=a&&1>=a&&(this.Z.layerSpacingParentOverlap=a,this.C()))}},compaction:{configurable:!0,get:function(){return this.Z.compaction},set:function(a){this.Z.compaction!==a&&(db(a,Z,Z,"compaction"),a===iu||a===ku)&&(this.Z.compaction=a,this.C())}},breadthLimit:{configurable:!0,get:function(){return this.Z.breadthLimit},
set:function(a){this.Z.breadthLimit!==a&&(A(a,"number",Z,"breadthLimit"),0<=a&&(this.Z.breadthLimit=a,this.C()))}},rowSpacing:{configurable:!0,get:function(){return this.Z.rowSpacing},set:function(a){this.Z.rowSpacing!==a&&(A(a,"number",Z,"rowSpacing"),this.Z.rowSpacing=a,this.C())}},rowIndent:{configurable:!0,get:function(){return this.Z.rowIndent},set:function(a){this.Z.rowIndent!==a&&(A(a,"number",Z,"rowIndent"),0<=a&&(this.Z.rowIndent=a,this.C()))}},commentSpacing:{configurable:!0,
enumerable:!0,get:function(){return this.Z.commentSpacing},set:function(a){this.Z.commentSpacing!==a&&(A(a,"number",Z,"commentSpacing"),this.Z.commentSpacing=a,this.C())}},commentMargin:{configurable:!0,get:function(){return this.Z.commentMargin},set:function(a){this.Z.commentMargin!==a&&(A(a,"number",Z,"commentMargin"),this.Z.commentMargin=a,this.C())}},setsPortSpot:{configurable:!0,get:function(){return this.Z.setsPortSpot},set:function(a){this.Z.setsPortSpot!==a&&(A(a,
"boolean",Z,"setsPortSpot"),this.Z.setsPortSpot=a,this.C())}},portSpot:{configurable:!0,get:function(){return this.Z.portSpot},set:function(a){w(a,Ib,Z,"portSpot");this.Z.portSpot.B(a)||(this.Z.portSpot=a,this.C())}},setsChildPortSpot:{configurable:!0,get:function(){return this.Z.setsChildPortSpot},set:function(a){this.Z.setsChildPortSpot!==a&&(A(a,"boolean",Z,"setsChildPortSpot"),this.Z.setsChildPortSpot=a,this.C())}},childPortSpot:{configurable:!0,get:function(){return this.Z.childPortSpot},
set:function(a){w(a,Ib,Z,"childPortSpot");this.Z.childPortSpot.B(a)||(this.Z.childPortSpot=a,this.C())}},alternateSorting:{configurable:!0,get:function(){return this.$.sorting},set:function(a){this.$.sorting!==a&&(db(a,Z,Z,"alternateSorting"),a===Zt||a===$t||a===au||bu)&&(this.$.sorting=a,this.C())}},alternateComparer:{configurable:!0,get:function(){return this.$.comparer},set:function(a){this.$.comparer!==a&&(A(a,"function",Z,"alternateComparer"),this.$.comparer=a,this.C())}},
alternateAngle:{configurable:!0,get:function(){return this.$.angle},set:function(a){this.$.angle!==a&&(A(a,"number",Z,"alternateAngle"),0===a||90===a||180===a||270===a)&&(this.$.angle=a,this.C())}},alternateAlignment:{configurable:!0,get:function(){return this.$.alignment},set:function(a){this.$.alignment!==a&&(db(a,Z,Z,"alternateAlignment"),this.$.alignment=a,this.C())}},alternateNodeIndent:{configurable:!0,get:function(){return this.$.nodeIndent},set:function(a){this.$.nodeIndent!==
a&&(A(a,"number",Z,"alternateNodeIndent"),0<=a&&(this.$.nodeIndent=a,this.C()))}},alternateNodeIndentPastParent:{configurable:!0,get:function(){return this.$.nodeIndentPastParent},set:function(a){this.$.nodeIndentPastParent!==a&&(A(a,"number",Z,"alternateNodeIndentPastParent"),0<=a&&1>=a&&(this.$.nodeIndentPastParent=a,this.C()))}},alternateNodeSpacing:{configurable:!0,get:function(){return this.$.nodeSpacing},set:function(a){this.$.nodeSpacing!==a&&(A(a,"number",Z,"alternateNodeSpacing"),
this.$.nodeSpacing=a,this.C())}},alternateLayerSpacing:{configurable:!0,get:function(){return this.$.layerSpacing},set:function(a){this.$.layerSpacing!==a&&(A(a,"number",Z,"alternateLayerSpacing"),this.$.layerSpacing=a,this.C())}},alternateLayerSpacingParentOverlap:{configurable:!0,get:function(){return this.$.layerSpacingParentOverlap},set:function(a){this.$.layerSpacingParentOverlap!==a&&(A(a,"number",Z,"alternateLayerSpacingParentOverlap"),0<=a&&1>=a&&(this.$.layerSpacingParentOverlap=
a,this.C()))}},alternateCompaction:{configurable:!0,get:function(){return this.$.compaction},set:function(a){this.$.compaction!==a&&(db(a,Z,Z,"alternateCompaction"),a===iu||a===ku)&&(this.$.compaction=a,this.C())}},alternateBreadthLimit:{configurable:!0,get:function(){return this.$.breadthLimit},set:function(a){this.$.breadthLimit!==a&&(A(a,"number",Z,"alternateBreadthLimit"),0<=a&&(this.$.breadthLimit=a,this.C()))}},alternateRowSpacing:{configurable:!0,get:function(){return this.$.rowSpacing},
set:function(a){this.$.rowSpacing!==a&&(A(a,"number",Z,"alternateRowSpacing"),this.$.rowSpacing=a,this.C())}},alternateRowIndent:{configurable:!0,get:function(){return this.$.rowIndent},set:function(a){this.$.rowIndent!==a&&(A(a,"number",Z,"alternateRowIndent"),0<=a&&(this.$.rowIndent=a,this.C()))}},alternateCommentSpacing:{configurable:!0,get:function(){return this.$.commentSpacing},set:function(a){this.$.commentSpacing!==a&&(A(a,"number",Z,"alternateCommentSpacing"),
this.$.commentSpacing=a,this.C())}},alternateCommentMargin:{configurable:!0,get:function(){return this.$.commentMargin},set:function(a){this.$.commentMargin!==a&&(A(a,"number",Z,"alternateCommentMargin"),this.$.commentMargin=a,this.C())}},alternateSetsPortSpot:{configurable:!0,get:function(){return this.$.setsPortSpot},set:function(a){this.$.setsPortSpot!==a&&(A(a,"boolean",Z,"alternateSetsPortSpot"),this.$.setsPortSpot=a,this.C())}},alternatePortSpot:{configurable:!0,
enumerable:!0,get:function(){return this.$.portSpot},set:function(a){w(a,Ib,Z,"alternatePortSpot");this.$.portSpot.B(a)||(this.$.portSpot=a,this.C())}},alternateSetsChildPortSpot:{configurable:!0,get:function(){return this.$.setsChildPortSpot},set:function(a){this.$.setsChildPortSpot!==a&&(A(a,"boolean",Z,"alternateSetsChildPortSpot"),this.$.setsChildPortSpot=a,this.C())}},alternateChildPortSpot:{configurable:!0,get:function(){return this.$.childPortSpot},set:function(a){w(a,
Ib,Z,"alternateChildPortSpot");this.$.childPortSpot.B(a)||(this.$.childPortSpot=a,this.C())}}});
var Ct=new F(Z,"PathDefault",-1),Dt=new F(Z,"PathDestination",0),Kt=new F(Z,"PathSource",1),Zt=new F(Z,"SortingForwards",10),$t=new F(Z,"SortingReverse",11),au=new F(Z,"SortingAscending",12),bu=new F(Z,"SortingDescending",13),Cu=new F(Z,"AlignmentCenterSubtrees",20),Du=new F(Z,"AlignmentCenterChildren",21),mu=new F(Z,"AlignmentStart",22),ru=new F(Z,"AlignmentEnd",23),du=new F(Z,"AlignmentBus",24),Ut=new F(Z,"AlignmentBusBranching",25),eu=new F(Z,"AlignmentTopLeftBus",26),fu=new F(Z,"AlignmentBottomRightBus",
27),iu=new F(Z,"CompactionNone",30),ku=new F(Z,"CompactionBlock",31),Et=new F(Z,"StyleLayered",40),Yt=new F(Z,"StyleLastParents",41),Xt=new F(Z,"StyleAlternating",42),Wt=new F(Z,"StyleRootOnly",43),Gt=new F(Z,"ArrangementVertical",50),Mu=new F(Z,"ArrangementHorizontal",51),Jt=new F(Z,"ArrangementFixedRoots",52),Ft=new F(Z,"LayerIndividual",60),St=new F(Z,"LayerSiblings",61),Rt=new F(Z,"LayerUniform",62);Z.className="TreeLayout";Z.PathDefault=Ct;Z.PathDestination=Dt;Z.PathSource=Kt;
Z.SortingForwards=Zt;Z.SortingReverse=$t;Z.SortingAscending=au;Z.SortingDescending=bu;Z.AlignmentCenterSubtrees=Cu;Z.AlignmentCenterChildren=Du;Z.AlignmentStart=mu;Z.AlignmentEnd=ru;Z.AlignmentBus=du;Z.AlignmentBusBranching=Ut;Z.AlignmentTopLeftBus=eu;Z.AlignmentBottomRightBus=fu;Z.CompactionNone=iu;Z.CompactionBlock=ku;Z.StyleLayered=Et;Z.StyleLastParents=Yt;Z.StyleAlternating=Xt;Z.StyleRootOnly=Wt;Z.ArrangementVertical=Gt;Z.ArrangementHorizontal=Mu;Z.ArrangementFixedRoots=Jt;Z.LayerIndividual=Ft;
Z.LayerSiblings=St;Z.LayerUniform=Rt;function Ht(a){fq.call(this,a)}ma(Ht,fq);Ht.prototype.createVertex=function(){return new It(this)};Ht.prototype.createEdge=function(){return new Ou(this)};Ht.className="TreeNetwork";
function It(a){tq.call(this,a);this.Da=!1;this.Mb=null;this.F=[];this.Vb=this.Ra=this.O=this.Ha=0;this.qd=null;this.Y=new K(0,0);this.Ca=new Hb(0,0);this.la=new K(0,0);this.Gm=this.Fm=this.eB=!1;this.Fq=this.tq=null;this.gd=Zt;this.Zc=Aq;this.Eb=0;this.Db=Du;this.Pr=this.Or=0;this.Qr=20;this.he=50;this.Fr=0;this.Zq=ku;this.Sq=0;this.Zr=25;this.Yq=this.Yr=10;this.Xq=20;this.ds=!0;this.Vr=dd;this.cs=!0;this.Vq=dd}ma(It,tq);
It.prototype.copyInheritedPropertiesFrom=function(a){null!==a&&(this.gd=a.sorting,this.Zc=a.comparer,this.Eb=a.angle,this.Db=a.alignment,this.Or=a.nodeIndent,this.Pr=a.nodeIndentPastParent,this.Qr=a.nodeSpacing,this.he=a.layerSpacing,this.Fr=a.layerSpacingParentOverlap,this.Zq=a.compaction,this.Sq=a.breadthLimit,this.Zr=a.rowSpacing,this.Yr=a.rowIndent,this.Yq=a.commentSpacing,this.Xq=a.commentMargin,this.ds=a.setsPortSpot,this.Vr=a.portSpot,this.cs=a.setsChildPortSpot,this.Vq=a.childPortSpot)};
na.Object.defineProperties(It.prototype,{initialized:{configurable:!0,get:function(){return this.Da},set:function(a){this.Da!==a&&(A(a,"boolean",It,"initialized"),this.Da=a)}},parent:{configurable:!0,get:function(){return this.Mb},set:function(a){this.Mb!==a&&(G&&null!==a&&w(a,It,It,"parent"),this.Mb=a)}},children:{configurable:!0,get:function(){return this.F},set:function(a){if(this.F!==a){null===a||Array.isArray(a)||za(a,"Array",It,"children:value");if(null!==
a)for(var b=a.length,c=0;c<b;c++){var d=a[c];G&&w(d,It,It,"children")}this.F=a}}},level:{configurable:!0,get:function(){return this.Ha},set:function(a){this.Ha!==a&&(A(a,"number",It,"level"),this.Ha=a)}},descendantCount:{configurable:!0,get:function(){return this.O},set:function(a){this.O!==a&&(A(a,"number",It,"descendantCount"),this.O=a)}},maxChildrenCount:{configurable:!0,get:function(){return this.Ra},set:function(a){this.Ra!==a&&(A(a,"number",It,"maxChildrenCount"),
this.Ra=a)}},maxGenerationCount:{configurable:!0,get:function(){return this.Vb},set:function(a){this.Vb!==a&&(A(a,"number",It,"maxGenerationCount"),this.Vb=a)}},comments:{configurable:!0,get:function(){return this.qd},set:function(a){if(this.qd!==a){null===a||Array.isArray(a)||za(a,"Array",It,"comments:value");if(null!==a)for(var b=a.length,c=0;c<b;c++){var d=a[c];G&&w(d,V,It,"comments")}this.qd=a}}},sorting:{configurable:!0,get:function(){return this.gd},
set:function(a){this.gd!==a&&(db(a,Z,It,"sorting"),this.gd=a)}},comparer:{configurable:!0,get:function(){return this.Zc},set:function(a){this.Zc!==a&&(A(a,"function",It,"comparer"),this.Zc=a)}},angle:{configurable:!0,get:function(){return this.Eb},set:function(a){this.Eb!==a&&(A(a,"number",It,"angle"),this.Eb=a)}},alignment:{configurable:!0,get:function(){return this.Db},set:function(a){this.Db!==a&&(db(a,Z,It,"alignment"),this.Db=a)}},nodeIndent:{configurable:!0,
enumerable:!0,get:function(){return this.Or},set:function(a){this.Or!==a&&(A(a,"number",It,"nodeIndent"),this.Or=a)}},nodeIndentPastParent:{configurable:!0,get:function(){return this.Pr},set:function(a){this.Pr!==a&&(A(a,"number",It,"nodeIndentPastParent"),this.Pr=a)}},nodeSpacing:{configurable:!0,get:function(){return this.Qr},set:function(a){this.Qr!==a&&(A(a,"number",It,"nodeSpacing"),this.Qr=a)}},layerSpacing:{configurable:!0,get:function(){return this.he},
set:function(a){this.he!==a&&(A(a,"number",It,"layerSpacing"),this.he=a)}},layerSpacingParentOverlap:{configurable:!0,get:function(){return this.Fr},set:function(a){this.Fr!==a&&(A(a,"number",It,"layerSpacingParentOverlap"),this.Fr=a)}},compaction:{configurable:!0,get:function(){return this.Zq},set:function(a){this.Zq!==a&&(db(a,Z,It,"compaction"),this.Zq=a)}},breadthLimit:{configurable:!0,get:function(){return this.Sq},set:function(a){this.Sq!==a&&(A(a,"number",
It,"breadthLimit"),this.Sq=a)}},rowSpacing:{configurable:!0,get:function(){return this.Zr},set:function(a){this.Zr!==a&&(A(a,"number",It,"rowSpacing"),this.Zr=a)}},rowIndent:{configurable:!0,get:function(){return this.Yr},set:function(a){this.Yr!==a&&(A(a,"number",It,"rowIndent"),this.Yr=a)}},commentSpacing:{configurable:!0,get:function(){return this.Yq},set:function(a){this.Yq!==a&&(A(a,"number",It,"commentSpacing"),this.Yq=a)}},commentMargin:{configurable:!0,
enumerable:!0,get:function(){return this.Xq},set:function(a){this.Xq!==a&&(A(a,"number",It,"commentMargin"),this.Xq=a)}},setsPortSpot:{configurable:!0,get:function(){return this.ds},set:function(a){this.ds!==a&&(A(a,"boolean",It,"setsPortSpot"),this.ds=a)}},portSpot:{configurable:!0,get:function(){return this.Vr},set:function(a){w(a,Ib,It,"portSpot");this.Vr.B(a)||(this.Vr=a)}},setsChildPortSpot:{configurable:!0,get:function(){return this.cs},set:function(a){this.cs!==
a&&(A(a,"boolean",It,"setsChildPortSpot"),this.cs=a)}},childPortSpot:{configurable:!0,get:function(){return this.Vq},set:function(a){w(a,Ib,It,"childPortSpot");this.Vq.B(a)||(this.Vq=a)}},childrenCount:{configurable:!0,get:function(){return this.children.length}},relativePosition:{configurable:!0,get:function(){return this.Y},set:function(a){this.Y.set(a)}},subtreeSize:{configurable:!0,get:function(){return this.Ca},set:function(a){this.Ca.set(a)}},
subtreeOffset:{configurable:!0,get:function(){return this.la},set:function(a){this.la.set(a)}}});It.className="TreeVertex";function Ou(a){uq.call(this,a);this.ju=new K(0,0)}ma(Ou,uq);
Ou.prototype.commit=function(){var a=this.link;if(null!==a&&!a.isAvoiding){var b=this.network.layout,c=null,d=null;switch(b.sd){case Dt:c=this.fromVertex;d=this.toVertex;break;case Kt:c=this.toVertex;d=this.fromVertex;break;default:v("Unhandled path value "+b.sd.toString())}if(null!==c&&null!==d)if(b=this.ju,0!==b.x||0!==b.y||c.eB){d=c.bounds;var e=lu(c),f=su(c),g=c.rowSpacing;a.Gg();var h=a.curve===gg,k=a.isOrthogonal,l;a.Wh();if(k||h){for(l=2;4<a.pointsCount;)a.Ov(2);var m=a.i(1);var n=a.i(2)}else{for(l=
1;3<a.pointsCount;)a.Ov(1);m=a.i(0);n=a.i(a.pointsCount-1)}var p=a.i(a.pointsCount-1);0===e?(c.alignment===ru?(e=d.bottom+b.y,0===b.y&&m.y>p.y+c.rowIndent&&(e=Math.min(e,Math.max(m.y,e-tu(c))))):c.alignment===mu?(e=d.top+b.y,0===b.y&&m.y<p.y-c.rowIndent&&(e=Math.max(e,Math.min(m.y,e+tu(c))))):e=c.Fm||c.Gm&&1===c.maxGenerationCount?d.top-c.la.y+b.y:d.y+d.height/2+b.y,h?(a.l(l,m.x,e),l++,a.l(l,d.right+f,e),l++,a.l(l,d.right+f+(b.x-g)/3,e),l++,a.l(l,d.right+f+2*(b.x-g)/3,e),l++,a.l(l,d.right+f+(b.x-
g),e),l++,a.l(l,n.x,e)):(k&&(a.l(l,d.right+f/2,m.y),l++),a.l(l,d.right+f/2,e),l++,a.l(l,d.right+f+b.x-(k?g/2:g),e),l++,k&&a.l(l,a.i(l-1).x,n.y))):90===e?(c.alignment===ru?(e=d.right+b.x,0===b.x&&m.x>p.x+c.rowIndent&&(e=Math.min(e,Math.max(m.x,e-tu(c))))):c.alignment===mu?(e=d.left+b.x,0===b.x&&m.x<p.x-c.rowIndent&&(e=Math.max(e,Math.min(m.x,e+tu(c))))):e=c.Fm||c.Gm&&1===c.maxGenerationCount?d.left-c.la.x+b.x:d.x+d.width/2+b.x,h?(a.l(l,e,m.y),l++,a.l(l,e,d.bottom+f),l++,a.l(l,e,d.bottom+f+(b.y-g)/
3),l++,a.l(l,e,d.bottom+f+2*(b.y-g)/3),l++,a.l(l,e,d.bottom+f+(b.y-g)),l++,a.l(l,e,n.y)):(k&&(a.l(l,m.x,d.bottom+f/2),l++),a.l(l,e,d.bottom+f/2),l++,a.l(l,e,d.bottom+f+b.y-(k?g/2:g)),l++,k&&a.l(l,n.x,a.i(l-1).y))):180===e?(c.alignment===ru?(e=d.bottom+b.y,0===b.y&&m.y>p.y+c.rowIndent&&(e=Math.min(e,Math.max(m.y,e-tu(c))))):c.alignment===mu?(e=d.top+b.y,0===b.y&&m.y<p.y-c.rowIndent&&(e=Math.max(e,Math.min(m.y,e+tu(c))))):e=c.Fm||c.Gm&&1===c.maxGenerationCount?d.top-c.la.y+b.y:d.y+d.height/2+b.y,h?
(a.l(l,m.x,e),l++,a.l(l,d.left-f,e),l++,a.l(l,d.left-f+(b.x+g)/3,e),l++,a.l(l,d.left-f+2*(b.x+g)/3,e),l++,a.l(l,d.left-f+(b.x+g),e),l++,a.l(l,n.x,e)):(k&&(a.l(l,d.left-f/2,m.y),l++),a.l(l,d.left-f/2,e),l++,a.l(l,d.left-f+b.x+(k?g/2:g),e),l++,k&&a.l(l,a.i(l-1).x,n.y))):270===e?(c.alignment===ru?(e=d.right+b.x,0===b.x&&m.x>p.x+c.rowIndent&&(e=Math.min(e,Math.max(m.x,e-tu(c))))):c.alignment===mu?(e=d.left+b.x,0===b.x&&m.x<p.x-c.rowIndent&&(e=Math.max(e,Math.min(m.x,e+tu(c))))):e=c.Fm||c.Gm&&1===c.maxGenerationCount?
d.left-c.la.x+b.x:d.x+d.width/2+b.x,h?(a.l(l,e,m.y),l++,a.l(l,e,d.top-f),l++,a.l(l,e,d.top-f+(b.y+g)/3),l++,a.l(l,e,d.top-f+2*(b.y+g)/3),l++,a.l(l,e,d.top-f+(b.y+g)),l++,a.l(l,e,n.y)):(k&&(a.l(l,m.x,d.top-f/2),l++),a.l(l,e,d.top-f/2),l++,a.l(l,e,d.top-f+b.y+(k?g/2:g)),l++,k&&a.l(l,n.x,a.i(l-1).y))):v("Invalid angle "+e);a.Hf()}else b=d,G&&w(c,It,Ou,"adjustRouteForAngleChange:parent"),G&&w(b,It,Ou,"adjustRouteForAngleChange:child"),a=this.link,f=lu(c),f!==lu(b)&&(g=su(c),h=c.bounds,c=b.bounds,0===
f&&c.left-h.right<g+1||90===f&&c.top-h.bottom<g+1||180===f&&h.left-c.right<g+1||270===f&&h.top-c.bottom<g+1||(a.Gg(),c=a.curve===gg,b=a.isOrthogonal,d=cu(this.fromVertex.alignment),a.Wh(),0===f?(f=h.right+g/2,c?4===a.pointsCount&&(c=a.i(3).y,a.P(1,f-20,a.i(1).y),a.l(2,f-20,c),a.l(3,f,c),a.l(4,f+20,c),a.P(5,a.i(5).x,c)):b?d?a.P(3,a.i(2).x,a.i(4).y):6===a.pointsCount&&(a.P(2,f,a.i(2).y),a.P(3,f,a.i(3).y)):4===a.pointsCount?a.l(2,f,a.i(2).y):3===a.pointsCount?a.P(1,f,a.i(2).y):2===a.pointsCount&&a.l(1,
f,a.i(1).y)):90===f?(f=h.bottom+g/2,c?4===a.pointsCount&&(c=a.i(3).x,a.P(1,a.i(1).x,f-20),a.l(2,c,f-20),a.l(3,c,f),a.l(4,c,f+20),a.P(5,c,a.i(5).y)):b?d?a.P(3,a.i(2).x,a.i(4).y):6===a.pointsCount&&(a.P(2,a.i(2).x,f),a.P(3,a.i(3).x,f)):4===a.pointsCount?a.l(2,a.i(2).x,f):3===a.pointsCount?a.P(1,a.i(2).x,f):2===a.pointsCount&&a.l(1,a.i(1).x,f)):180===f?(f=h.left-g/2,c?4===a.pointsCount&&(c=a.i(3).y,a.P(1,f+20,a.i(1).y),a.l(2,f+20,c),a.l(3,f,c),a.l(4,f-20,c),a.P(5,a.i(5).x,c)):b?d?a.P(3,a.i(2).x,a.i(4).y):
6===a.pointsCount&&(a.P(2,f,a.i(2).y),a.P(3,f,a.i(3).y)):4===a.pointsCount?a.l(2,f,a.i(2).y):3===a.pointsCount?a.P(1,f,a.i(2).y):2===a.pointsCount&&a.l(1,f,a.i(1).y)):270===f&&(f=h.top-g/2,c?4===a.pointsCount&&(c=a.i(3).x,a.P(1,a.i(1).x,f+20),a.l(2,c,f+20),a.l(3,c,f),a.l(4,c,f-20),a.P(5,c,a.i(5).y)):b?d?a.P(3,a.i(2).x,a.i(4).y):6===a.pointsCount&&(a.P(2,a.i(2).x,f),a.P(3,a.i(3).x,f)):4===a.pointsCount?a.l(2,a.i(2).x,f):3===a.pointsCount?a.P(1,a.i(2).x,f):2===a.pointsCount&&a.l(1,a.i(1).x,f)),a.Hf()))}};
na.Object.defineProperties(Ou.prototype,{fromVertex:{configurable:!0,get:function(){return this.ad},set:function(a){this.ad!==a&&(G&&null!==a&&w(a,It,Ou,"fromVertex"),this.ad=a)}},toVertex:{configurable:!0,get:function(){return this.kd},set:function(a){this.kd!==a&&(G&&null!==a&&w(a,It,Ou,"toVertex"),this.kd=a)}},relativePoint:{configurable:!0,get:function(){return this.ju},set:function(a){this.ju.set(a)}}});Ou.className="TreeEdge";
Va.prototype.initializeStandardTools=function(){this.gb("Action",new Gg,this.mouseDownTools);this.gb("Relinking",new cf,this.mouseDownTools);this.gb("LinkReshaping",new eg,this.mouseDownTools);this.gb("Rotating",new sg,this.mouseDownTools);this.gb("Resizing",new lg,this.mouseDownTools);this.gb("Linking",new Yf,this.mouseMoveTools);this.gb("Dragging",new Re,this.mouseMoveTools);this.gb("DragSelecting",new Jg,this.mouseMoveTools);this.gb("Panning",new Kg,this.mouseMoveTools);this.gb("ContextMenu",new Mg,
this.mouseUpTools);this.gb("TextEditing",new Xg,this.mouseUpTools);this.gb("ClickCreating",new Hg,this.mouseUpTools);this.gb("ClickSelecting",new tg,this.mouseUpTools)};Bn("Horizontal",new Dm);Bn("Spot",new Fm);Bn("Table",new Km);Bn("Viewbox",new Pm);Bn("TableRow",new Nm);Bn("TableColumn",new Om);Bn("Graduated",new Zm);Bn("Grid",new Qm);ui.add("GraphLinksModel",Tq);ui.add("TreeModel",gr);lq(os,null);lq(Es,null);
var Pu=sa.go,Qu={get licenseKey(){return Q.licenseKey},set licenseKey(a){Q.licenseKey=a},get version(){return Q.version},Group:yf,EnumValue:F,List:H,Set:I,Map:yb,Point:K,Size:Hb,Rect:M,Margin:fc,Spot:Ib,Geometry:N,PathFigure:le,PathSegment:me,InputEvent:oe,DiagramEvent:qe,ChangedEvent:re,Model:Y,GraphLinksModel:Cr,TreeModel:Hr,Binding:Fi,Transaction:we,UndoManager:xe,CommandHandler:Zk,Tool:ze,DraggingTool:Re,DraggingInfo:df,DraggingOptions:Se,LinkingBaseTool:Jf,LinkingTool:Yf,RelinkingTool:cf,LinkReshapingTool:eg,
ResizingTool:lg,RotatingTool:sg,ClickSelectingTool:tg,ActionTool:Gg,ClickCreatingTool:Hg,HTMLInfo:Pe,ContextMenuTool:Mg,DragSelectingTool:Jg,PanningTool:Kg,TextEditingTool:Xg,ToolManager:Va,Animation:sh,AnimationManager:oh,AnimationTrigger:hi,Layer:mi,Diagram:Q,Palette:Sk,Overview:Vk,Brush:vl,GraphObject:O,Panel:X,RowColumnDefinition:Wj,Shape:Kf,TextBlock:Yg,Picture:ek,Part:U,Adornment:Ke,Node:V,Link:R,Placeholder:ng,Layout:zi,LayoutNetwork:fq,LayoutVertex:tq,LayoutEdge:uq,GridLayout:Uk,PanelLayout:Tl,
CircularLayout:Ir,CircularNetwork:Zr,CircularVertex:ms,CircularEdge:ns,ForceDirectedLayout:os,ForceDirectedNetwork:ps,ForceDirectedVertex:zs,ForceDirectedEdge:Ds,LayeredDigraphLayout:Es,LayeredDigraphNetwork:Js,LayeredDigraphVertex:At,LayeredDigraphEdge:Bt,TreeLayout:Z,TreeNetwork:Ht,TreeVertex:It,TreeEdge:Ou};"object"===typeof Pu&&Pu.version&&v("WARNING: a `go` object on the root object is already defined.  "+("Debug"in Pu?"debug ":"")+"version: "+Pu.version+", replaced with version: "+Qu.version);
Q.prototype.go=Qu;sa.go=Qu;("undefined"===typeof sa||"undefined"===typeof sa.module||"object"!==typeof sa.module.exports)&&sa.define&&"function"===typeof sa.define&&sa.define.amd&&sa.define(Qu);Qu.Debug=G;G.yz(Qu); 'undefined'!==typeof module&&'object'===typeof module.exports&&(module.exports='undefined'!==typeof global?global.go:self.go); })();



  export default (typeof global !== "undefined") ? global.go : self.go;
  export const go = (typeof global !== "undefined") ? global.go : self.go;
export const Group = go.Group;
export const EnumValue = go.EnumValue;
export const List = go.List;
export const Set = go.Set;
export const Map = go.Map;
export const Point = go.Point;
export const Size = go.Size;
export const Rect = go.Rect;
export const Margin = go.Margin;
export const Spot = go.Spot;
export const Geometry = go.Geometry;
export const PathFigure = go.PathFigure;
export const PathSegment = go.PathSegment;
export const InputEvent = go.InputEvent;
export const DiagramEvent = go.DiagramEvent;
export const ChangedEvent = go.ChangedEvent;
export const Model = go.Model;
export const GraphLinksModel = go.GraphLinksModel;
export const TreeModel = go.TreeModel;
export const Binding = go.Binding;
export const Transaction = go.Transaction;
export const UndoManager = go.UndoManager;
export const CommandHandler = go.CommandHandler;
export const Tool = go.Tool;
export const DraggingTool = go.DraggingTool;
export const DraggingInfo = go.DraggingInfo;
export const LinkingBaseTool = go.LinkingBaseTool;
export const LinkingTool = go.LinkingTool;
export const RelinkingTool = go.RelinkingTool;
export const LinkReshapingTool = go.LinkReshapingTool;
export const ResizingTool = go.ResizingTool;
export const RotatingTool = go.RotatingTool;
export const ClickSelectingTool = go.ClickSelectingTool;
export const ActionTool = go.ActionTool;
export const ClickCreatingTool = go.ClickCreatingTool;
export const HTMLInfo = go.HTMLInfo;
export const ContextMenuTool = go.ContextMenuTool;
export const DragSelectingTool = go.DragSelectingTool;
export const PanningTool = go.PanningTool;
export const TextEditingTool = go.TextEditingTool;
export const ToolManager = go.ToolManager;
export const Animation = go.Animation;
export const AnimationManager = go.AnimationManager;
export const AnimationTrigger = go.AnimationTrigger;
export const Layer = go.Layer;
export const Diagram = go.Diagram;
export const Palette = go.Palette;
export const Overview = go.Overview;
export const Brush = go.Brush;
export const GraphObject = go.GraphObject;
export const Panel = go.Panel;
export const RowColumnDefinition = go.RowColumnDefinition;
export const Shape = go.Shape;
export const TextBlock = go.TextBlock;
export const TextBlockMetrics = go.TextBlockMetrics;
export const Picture = go.Picture;
export const Part = go.Part;
export const Adornment = go.Adornment;
export const Node = go.Node;
export const Link = go.Link;
export const Placeholder = go.Placeholder;
export const Layout = go.Layout;
export const LayoutNetwork = go.LayoutNetwork;
export const LayoutVertex = go.LayoutVertex;
export const LayoutEdge = go.LayoutEdge;
export const GridLayout = go.GridLayout;
export const PanelLayout = go.PanelLayout;
export const CircularLayout = go.CircularLayout;
export const CircularNetwork = go.CircularNetwork;
export const CircularVertex = go.CircularVertex;
export const CircularEdge = go.CircularEdge;
export const ForceDirectedLayout = go.ForceDirectedLayout;
export const ForceDirectedNetwork = go.ForceDirectedNetwork;
export const ForceDirectedVertex = go.ForceDirectedVertex;
export const ForceDirectedEdge = go.ForceDirectedEdge;
export const LayeredDigraphLayout = go.LayeredDigraphLayout;
export const LayeredDigraphNetwork = go.LayeredDigraphNetwork;
export const LayeredDigraphVertex = go.LayeredDigraphVertex;
export const LayeredDigraphEdge = go.LayeredDigraphEdge;
export const TreeLayout = go.TreeLayout;
export const TreeNetwork = go.TreeNetwork;
export const TreeVertex = go.TreeVertex;
export const TreeEdge = go.TreeEdge;
export const version = go.version;
